microsoft / dbt-fabric

MIT License
78 stars 26 forks source link

Config precedence not implemented correctly #214

Closed tkiehn closed 2 months ago

tkiehn commented 3 months ago

Hi,

I have a model and in the model's .sql-file I have set {{ config(materialized='incremental') }}. In the dbt_project.yml I set a materialization under the models key for the whole project like this:

models:
  my_fabric_project:
      +materialized: view

What I expect:

The materialization from the config-block supersedes the one from the dbt_project.yml.

What I observe:

The value of model.config.materialized inside the is_incremental-macro is the one set inside the dbt_project.yml instead of the config block. The behaviour is same for views and tables as values for +materialized:. is_incremental then returns false, therefore dbt is always running in full-refresh-mode.

Removal of setting the materialization in the dbt_project.yml fixed it and the model is correctly run in incremental mode because the value of model.config.materialized is incremental.

Kind Regards Theo

prdpsvs commented 2 months ago

@tkiehn , I got confirmation from dbt adapters (dbt labs) team that config precedence is managed by dbt-adapters/dbt-core. I will transfer this issue to dbt-adapters repo once my access to dbt-adapters is figured out.

prdpsvs commented 2 months ago

@tkiehn , I was not able to transfer this issue. I created a new issue in dbt-adapters https://github.com/dbt-labs/dbt-core/issues/10711.

I am closing this issue as it with dbt-adapters. Please re-open issue in the future with more details.