Search code examples
snowflake-cloud-data-platformdbt

Changing 'dbt' materialized value after table creation


We are using DBT to add table to snowflake. We have a table created with drop and load logic which we want to change to incremental logic. Is there any issue if we change the logic now. Will the table be dropped and reloaded or will the logic be valid only for further ingestions?


Solution

  • When you change the materialization to "incremental" dbt will check if the table exists, and if it exists, will keep adding to it.

    But there are a lot of subtleties to this, so it would help if you had shared your specific model to give you specific guidance.

    Make sure to use {% if is_incremental() %} to get correct results, and an unique id if you need updates.

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