-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Is this a new bug in dbt-core?
- I believe this is a new bug in dbt-core
- I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
When working within my company's workflow, we outline all configurations, metadata, etc. in the schema.yml
file, with broader configurations being described in the dbt_projects.yml
. However, the materialization of Python models cannot be controlled through these files. This requires us to set the configuration within the model itself, as demonstrated below:
def model(dbt, session):
dbt.config(materialization='incremental')
...
If this isn't done, the materialization always defaults to 'table' in the generated manifest.json
.
commit that introduces this behavior: https://github.com/dbt-labs/dbt-core/blame/48d04e81417195393af5af1f78ef695f3398f193/core/dbt/parser/base.py#L217
Expected Behavior
I would expect that the materialization of Python models could be controlled through these configuration files, just as it is observed with SQL models. Ideally, without having to specify the materialization within the model itself. When defining configurations in these files, they should be respected, and the materialization shouldn't default to 'table' in the generated manifest.json unless explicitly set to do so. The current behavior introduces an inconsistency in the way dbt models are configured and managed.
Steps To Reproduce
-
Ensure you are using dbt version 1.4 or newer.
-
Create a Python model with a materialization setting other than 'table' specified either in dbt_projects.yml or schema.yml.
-
Execute dbt run. Observe in the terminal that the materialization is displayed as 'table'.
-
Upon inspecting the manifest.json, you'll find that all other configurations are respected, except for the materialization which defaults to 'table'.
Relevant log output
No response
Environment
- OS: Ubuntu 20.04.6 LTS
- Python: 3.10.9
- dbt: (tested with multiple versions: 1.4, 1.5, and 1.6.1)
Which database adapter are you using with dbt?
spark, other (mention it in "Additional Context")
Additional Context
database adatpter: dbt-databricks
commit that introduces this behavior: https://github.com/dbt-labs/dbt-core/blame/48d04e81417195393af5af1f78ef695f3398f193/core/dbt/parser/base.py#L217
I've some workarounds to fix this. If this issue is accepted I can send a PR.