This dbt project is a worked example to demonstrate how to use snapshots to detect dbt model regressions. Check out the full write-up on Discourse.
The SQL in this project is compatible with Snowflake¹.
If you want to run this project yourself to play with it (assuming you have dbt installed):
- Clone this repo.
cd
into this directory- Create a profile named
acme
, or update theprofile:
key in thedbt_project.yml
file to point to an existing profile (docs). - Run
dbt seed
. - Run
dbt snapshot
. - Run
dbt test
— no test failures should occur. - Run
dbt snapshot
a second time — on this run, a regression should be introduced. - Run
dbt test
to see the failure. - Run
dbt run-operation historic_revenue_snapshot_cleanup
to move the rogue record into an audit table. - Run
dbt test
again to see the healed failure.
- We decided to not check that the SQL in this project is multi-warehouse compatible — it might work on other warehouses!