Open jeremyyeo opened 1 month ago
Thanks for such a complete view of things @jeremyyeo 🤩
Configurations in your root dbt project have higher precedence than configurations in installed packages.
👆 I think what is happening is that this statement above is trumping everything else. i.e., Configurations in your root dbt project have higher precedence than everything else related to config precedence.
Since we have this behavior documented, I don't think its a bug, and we probably won't make a change in dbt-core. However, this shows us that this can definitely be surprising / "gotcha" behavior.
Here's some ideas of next steps:
+materialized
in dbt_project.yml
. Add it scoped to each package as desired+materialized
in dbt_project.yml
+materialized
) in dbt_project.yml
dbt_project_evaluator
whenever there is an unscoped configuration (like +materialized
) in dbt_project.yml
I'm curious if you have any thoughts about these or other ideas @jeremyyeo ?
Is this a new bug in dbt-core?
Current Behavior
Configs set in the root dbt_project.yml that aren't scoped to the root dbt project are taking precedent over config blocks set in model.sql files that are within packages.
Expected Behavior
Configs set in the root dbt_project.yml that aren't scoped to the root dbt project should not take precedent over config blocks set in model.sql files that are within packages.
Steps To Reproduce
public-package
) like so:^ Here the model
tbl_config_block
that is in the package has ignored it's own{{ config(materialized='table') }}
.As we know about config inheritance (https://docs.getdbt.com/reference/configs-and-properties#config-inheritance):
However we also say:
So I'm not sure how to reconcile those facts and make
tbl_config_block
ignore the+materialized: view
that is set unscoped in thedbt_project.yml
file.Relevant log output
No response
Environment
Which database adapter are you using with dbt?
postgres
Additional Context
This arose cause a customer was doing exactly (unscoped +materialized in the
dbt_project.yml
) that but also using the dbt-project-evaluator package which raises an exception when the materialization of its models are not tables (https://github.com/dbt-labs/dbt-project-evaluator/blob/main/models/staging/graph/stg_nodes.sql).