snowflake-cloud-data-platformdbt

Does dbt 0.21.0 on_schema_change requires --full-refresh?


regarding the new on_schema_change='sync_all_columns' config I have a question. I tested it a bunch of times and it seems that on adding a new column it doesn't automatically insert data into it. Also it doesn't really perform on the datatype changes it implies.

{{
   config(
   materialized='incremental',
   on_schema_change='sync_all_columns',
   incremental_strategy='merge'
   )
}}

(https://docs.getdbt.com/docs/building-a-dbt-project/building-models/configuring-incremental-models)

Am I doing something wrong?


Solution

  • As far as I understand the documentation: Incremental models can now be configured to include an optional on_schema_change parameter to enable additional control when incremental model columns change. These options enable dbt to continue running incremental models in the presence of schema changes, resulting in fewer --full-refresh scenarios and saving query costs.

    Looks like it shouldn't run full-refresh link: https://docs.getdbt.com/docs/building-a-dbt-project/building-models/configuring-incremental-models#what-if-the-columns-of-my-incremental-model-change