-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
CT-729 Include schema model config in unrendered config #5344
Conversation
@jtcohen6 I didn't find any actual documentation about what unrendered_config is supposed to contain. The code goes to some trouble to not include the config from dbt_project.yml. I'm not exactly clear on why that is. Could you cast some light on it? |
@gshank My impression is that # dbt_project.yml
models:
+enabled: "{{ target.name == 'dev' }}" The entry for a model node in the manifest should show up like: "config": {
"enabled": true,
"alias": null,
"schema": null,
"database": null,
"tags": [],
"meta": {},
"materialized": "view",
"persist_docs": {},
"quoting": {},
"column_types": {},
"full_refresh": null,
"unique_key": null,
"on_schema_change": "ignore",
"grants": {},
"packages": [],
"post-hook": [],
"pre-hook": []
},
...
"unrendered_config": {
"enabled": "{{ target.name == 'dev' }}"
}, dbt should use the "unrendered" form of Docs on this behavior: https://docs.getdbt.com/reference/node-selection/state-comparison-caveats#false-positives I believe we are updating dbt-core/core/dbt/parser/base.py Lines 289 to 291 in e48f7ab
|
If you look at "build_config_dict" in core/dbt/context/context_config.py it uses different renderers for rendered and unrendered. The "unrendered" flavor uses UnrenderedConfigGenerator. If you compare that to ContextConfigGenerator, the unrendered config generator explicitly skips loading the config from dbt_project.yml. |
It looks like the issue is not that the dbt_project.yml config isn't processed, but that the unrendered_config dictionaries aren't merged, so that we lose dbt_project.yml config items in unrendered_config that are overwritten by later config. The actual config in the node is correct, because that part is merged properly. |
Removing myself as a reviewer on this one since I don't know enough about parsing to be useful here. |
f764b26
to
a238f2e
Compare
@gshank Did we decide if the behavior change here was the right one? Or better than the status quo, at least? I remember discussing that we don't have any way to access the unrendered form of patch ( |
My recollection is that not including the dbt_project configs when re-rendering was actually a bug. |
* Pass patch_config_dict to build_config_dict when creating unrendered_config * Add test case for unrendered_config * Changie * formatting, fix test * Fix test so unrendered config includes docs config
* Pass patch_config_dict to build_config_dict when creating unrendered_config * Add test case for unrendered_config * Changie * formatting, fix test * Fix test so unrendered config includes docs config
resolves #5338
Description
Unrendered_config originally only included config from models. When we added config for models in schema files, we didn't include that in unrendered_config. Unrendered_config still doesn't include model config from dbt_project.yml, since the code explicitly avoided that.
Checklist
changie new
to create a changelog entry