Snapshots in Snowflake replacing table instead of merge

Hi all,
I’ve using dbt with Snowflake. We have a lot of snapshot models that run daily. For several months after we set them up, they were operating as expected: a temporary table (suffixed with __dbt_tmp) would be created with new data, then a MERGE statement would get new data into the persistent snapshot table.

Starting Feb 2 2023, the behavior changed. Now on every run it will CREATE OR REPLACE the snapshot table. This is not the behavior we want as it loses the historical data.

As far as I can tell, we did not change anything about our configuration or the snapshot models themselves.

My questions:

  • Is it conceivable that dbt’s behavior changed with a new release around that time?
  • How does one configure these two different behaviors in a snapshot?

In case anyone has the same problem and finds this:

Root cause was our customized version of the generate_schema_name macro, which was generating an extra linefeed character after the schema name. That plus a known dbt bug: Database and schema names with new lines work on Snowflake... until they don't · Issue #2466 · dbt-labs/dbt-core · GitHub resulted in the behavior I saw.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.