You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chronitis opened this issue
Apr 21, 2023
· 2 comments
Labels
bugSomething isn't workingduplicateThis issue or pull request already existsuser docs[docs.getdbt.com] Needs better documentationwontfixNot a bug or out of scope for dbt-core
When we compile project B, models in project B behave as expected - they use a incremental_strategy configured in the sql file if set, or the default ("beta") if not. However, models from project A all have their incremental_strategy overwritten with "beta", even if they had a more specific configuration in their SQL file.
This seems surprising, since I expected the more specific config in Project A to "win".
(This is not specific to incremental_strategy, and the same effect can be found with other config keys).
github-actionsbot
changed the title
[Bug] Package-level model default config taking precedence over model-specific config in another package
[CT-2458] [Bug] Package-level model default config taking precedence over model-specific config in another package
Apr 21, 2023
Configurations made in your dbt_project.yml file will override any configurations in a package (either in the dbt_project.yml file of the package, or in config blocks).
The intent of this behavior is to enable users of packages that they don't own/maintain to make changes to models from those packages, without needing to copy-paste-edit the code themselves. Doug offered an excellent and thorough explanation in a comment on the issue linked above:
@jtcohen6 thanks for the quick response and explaining the design decision here.
I had read that page, but I'd clearly not taken in that part. I can see the argument that it makes sense to be able to reconfigure imported models, although I did still find the apparent inversion in precedence surprising.
bugSomething isn't workingduplicateThis issue or pull request already existsuser docs[docs.getdbt.com] Needs better documentationwontfixNot a bug or out of scope for dbt-core
Is this a new bug in dbt-core?
Current Behavior
In project B, we include project A (which includes models) as a package:
Models in project A have specific
config()
within the model SQL file:While project B sets a default value for some of the same keys in
dbt_project.yml
:When we compile project B, models in project B behave as expected - they use a
incremental_strategy
configured in the sql file if set, or the default ("beta") if not. However, models from project A all have theirincremental_strategy
overwritten with "beta", even if they had a more specific configuration in their SQL file.This seems surprising, since I expected the more specific config in Project A to "win".
(This is not specific to
incremental_strategy
, and the same effect can be found with other config keys).Expected Behavior
Per https://docs.getdbt.com/reference/model-configs#configuring-models, I expect the most specific configuration - within the SQL file in project A - to win, rather than the default package configuration in project B.
Steps To Reproduce
As per the Current behavior above, this appears to require:
dbt compile
shows that the second project's default config wins over the first project's seemingly more specific config.Relevant log output
No response
Environment
Which database adapter are you using with dbt?
redshift
Additional Context
Possibly related to #6705
The text was updated successfully, but these errors were encountered: