-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT] Use DBT model contracts #95
Comments
Hi @kevinalh Thanks for the request! Could you describe a little bit of your solution (in more user guide detail) here first before development? I am imagining that would a new algo module e.g. dbterd run —algo model_contract, but feel free to suggest it! I will mark it help-wanted now. |
👋 @kevinalh Just a check if you are being on this now? Otherwise I can go implement it next week? Thanks |
Hi @datnguye ! Unfortunately got busy with multiple things these days so didn't follow up on this. Feel free to go ahead with the implementation, if you got time |
Hi @kevinalh Sorry I have to withdraw my words now since I'm very busy in my Paternity Leave period. |
Just giving some suggestions on this enhencement, but feel free to do as you go 🙌
At the end, it supposed to be able to run below commands:
|
@kevinalh Thanks for making a good issue! I also use dbt model contracts and am very happy to see them supported in dbterd. @datnguye I am interested in implementing support for dbt model contracts. For my use case it is enough to implement BTW, I just looked at the contents of #103. Is @datnguye already working on the implementation? If not, or if it is too difficult for you to take the time, I will send a pull request. I will be working on it over the weekend, so it could take a little longer... |
Hi @syou6162 , haven't started working on this either, thanks for offering help with this issue! |
@kevinalh @datnguye I tried to get model contracts in this weekend. After much thought, I decided that it is better not to try to support model contracts at this stage. I'll explain why below.
|
Thanks @syou6162! That’s very useful info 🙌 I think we can still provide some early support to the current model contract’s metadata. The only hard part is to parse the expression, I guess, to know the referenced node. Also I can seem to see one more limitation that the constraints config is just for the model resource type only. After all, I think that we can still proceed to implement a module to support model contract now with the given known limitations in documentation. |
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days. |
Sorry for the late reply. Since dbt 1.9, it is now possible to use |
Is your feature request related to a problem? Please describe.
DBT introduced model contracts in 1.5.
The constraints field has a way of setting up foreign keys as part of the contract. I don't see a way to use this feature in the dbterd documentation. My models are too big for the relationships tests to run.
Describe the solution you'd like
Supporting inferring relationships from DBT model contract native constraints.
If already possible, specifying so in the documentation would be great.
Describe alternatives you've considered
I can use the Snowflake dbt_constraints package, but I'd rather use the native DBT constraints feature if that's available. Also dbt_constraints functionality of creating Snowflake constraints is compatible with native model contracts so that's another reason I'd write the native code instead.
I could also use
dbt_utils.relationships_where
but I'm not sure how (maybe it's possible with the algorithm selection command line syntax?)I can help writing the code (really like this project!), but want to make sure there's not something I'm missing first. Thanks!
The text was updated successfully, but these errors were encountered: