High severitydbt
Power BI Refresh Error:
Snapshot Strategy Failure
What does this error mean?
A dbt snapshot failed during execution. Snapshots track slowly-changing dimensions by comparing current source data to the previously stored state. Failures occur when the unique_key or updated_at column is missing, has duplicates, or when the snapshot table schema drifts.
Common causes
- 1The `unique_key` column has duplicate values in the source, violating the snapshot merge strategy
- 2The `updated_at` column used for the timestamp strategy has NULL values
- 3The snapshot table in the warehouse was manually altered or dropped, causing a schema mismatch on the next run
- 4The source data contains more rows than expected and the snapshot query runs out of warehouse resources
- 5A check strategy snapshot has too many monitored columns, causing excessive row churn and slow performance
How to fix it
- 1Verify the unique_key column has no duplicates in the source: `SELECT <unique_key>, COUNT(*) FROM <source> GROUP BY 1 HAVING COUNT(*) > 1`.
- 2For timestamp strategy: confirm the updated_at column is NOT NULL and is a valid timestamp.
- 3If the snapshot table was manually modified, either recreate it by running with `--full-refresh` or align its schema to what dbt expects.
- 4Reduce the number of columns in a check strategy snapshot by switching to a timestamp strategy if an updated_at field is available.
- 5Add a WHERE clause to the snapshot SELECT to exclude known-duplicate rows at the source level.
Frequently asked questions
Official documentation: https://docs.getdbt.com/docs/build/snapshots