# \#snapshots

**URL:** https://discourse.getdbt.com/tag/snapshots/11.md

[Latest](https://discourse.getdbt.com/latest.md) · [Categories](https://discourse.getdbt.com/categories.md) · [Tags](https://discourse.getdbt.com/tags.md)

---

## [Snapshots must be configured with a 'strategy' and 'unique\_key'](https://discourse.getdbt.com/t/snapshots-must-be-configured-with-a-strategy-and-unique-key/20340)

<div class="topic-metadata">

**Author:** [@sarahs](https://discourse.getdbt.com/u/sarahs)\
**Replies:** 0\
**Last updated:** [October 20, 2025, 11:55am UTC](https://discourse.getdbt.com/t/snapshots-must-be-configured-with-a-strategy-and-unique-key/20340 "2025-10-20T11:55:23Z")

</div>

The problem I’m having When i configure snapshot in a yml file, I encounter an error: raise ValidationError( “Snapshots must be configured with a ‘strategy’ and ‘unique\_key’.” ) dbt\_common.dataclass\_schema.Validation…

---

## [I have a question about unique column in Snapshot comparision while merge.](https://discourse.getdbt.com/t/i-have-a-question-about-unique-column-in-snapshot-comparision-while-merge/20019)

<div class="topic-metadata">

**Author:** [@adhakal321](https://discourse.getdbt.com/u/adhakal321)\
**Replies:** 1\
**Last updated:** [August 4, 2025, 6:05pm UTC](https://discourse.getdbt.com/t/i-have-a-question-about-unique-column-in-snapshot-comparision-while-merge/20019 "2025-08-04T18:05:11Z")

</div>

The problem I’m having with dbt snapshot on dbt\_scd\_id. The context of why I’m trying to do this: I need to create an SCD Type 2 table. While generating the snapshot, a hashed column dbt\_scd\_id is created by concatenatin…

---

## [Snapshot Hard Deletes New Record.](https://discourse.getdbt.com/t/snapshot-hard-deletes-new-record/18939)

<div class="topic-metadata">

**Author:** [@UpDaDeise](https://discourse.getdbt.com/u/UpDaDeise)\
**Replies:** 1\
**Last updated:** [July 21, 2025, 3:45pm UTC](https://discourse.getdbt.com/t/snapshot-hard-deletes-new-record/18939 "2025-07-21T15:45:35Z")

</div>

Hard Delete = New Record causing extra records Using the new Snapshot Format Excuted the new Snapshot. I have set up a standard test. Once I run my snapshot, the delete record is set as expected. However each time I ru…

---

## [Snapshot Setup -- Can I use hard-deletes with dbt-duckdb adapter?](https://discourse.getdbt.com/t/snapshot-setup-can-i-use-hard-deletes-with-dbt-duckdb-adapter/19852)

<div class="topic-metadata">

**Author:** [@megan.wolfe](https://discourse.getdbt.com/u/megan.wolfe)\
**Replies:** 0\
**Last updated:** [July 14, 2025, 2:56pm UTC](https://discourse.getdbt.com/t/snapshot-setup-can-i-use-hard-deletes-with-dbt-duckdb-adapter/19852 "2025-07-14T14:56:01Z")

</div>

The problem I’m having I’m using dbt-core with a dbt-duckdb adapter and am trying to create a snapshot table to track what rows are deleted and when the deletion occurred. No issues with the setup of the snapshot table i…

---

## [snapshot.sql file in the repository dbt-core](https://discourse.getdbt.com/t/snapshot-sql-file-in-the-repository-dbt-core/19687)

<div class="topic-metadata">

**Author:** [@hibou](https://discourse.getdbt.com/u/hibou)\
**Replies:** 0\
**Last updated:** [June 20, 2025, 8:09am UTC](https://discourse.getdbt.com/t/snapshot-sql-file-in-the-repository-dbt-core/19687 "2025-06-20T08:09:26Z")

</div>

I’m trying to understand the snapshot mechanism core/dbt/include/global\_project/macros/materializations/snapshot/snapshot.sql but the file is no longer in the repository Can someone tell where is the file actually ?

---

## [The output of the snapshot does not look to what I expected](https://discourse.getdbt.com/t/the-output-of-the-snapshot-does-not-look-to-what-i-expected/19233)

<div class="topic-metadata">

**Author:** [@promediazadrianlearn](https://discourse.getdbt.com/u/promediazadrianlearn)\
**Replies:** 1\
**Last updated:** [May 1, 2025, 2:21pm UTC](https://discourse.getdbt.com/t/the-output-of-the-snapshot-does-not-look-to-what-i-expected/19233 "2025-05-01T14:21:12Z")

</div>

I’m creating a snapshot model from Hubspot deal table with the following configuration snapshots: - name: snapshot\_hubspot\_deals relation: ref('ephemeral\_hubspot\_deals') config: schema: snapshots d…

---

## [Stop downstream model creation when dbt test fails](https://discourse.getdbt.com/t/stop-downstream-model-creation-when-dbt-test-fails/19193)

<div class="topic-metadata">

**Author:** [@tsavic](https://discourse.getdbt.com/u/tsavic)\
**Replies:** 1\
**Last updated:** [April 28, 2025, 6:36pm UTC](https://discourse.getdbt.com/t/stop-downstream-model-creation-when-dbt-test-fails/19193 "2025-04-28T18:36:42Z")

</div>

I’m using dbt Cloud and two folders: foundation and dwh. I imported Snowflake table as a source in dbt. Then i created: In foundation folder: model on top of that source (data clean up) snapshot which records the state…

---

## [Inventory Snapshot Comparison Best Practice](https://discourse.getdbt.com/t/inventory-snapshot-comparison-best-practice/19069)

<div class="topic-metadata">

**Author:** [@np\_qube](https://discourse.getdbt.com/u/np_qube)\
**Replies:** 0\
**Last updated:** [April 17, 2025, 5:09am UTC](https://discourse.getdbt.com/t/inventory-snapshot-comparison-best-practice/19069 "2025-04-17T05:09:38Z")

</div>

Hi everyone :waving\_hand:, I’m currently working on an inventory management reporting pipeline using dbt, and I’m exploring the best practice approach for point-in-time inventory tracking and comparison across multiple …

---

## [Snapshot DBT\_CAHNGE\_TYPE Metadata column](https://discourse.getdbt.com/t/snapshot-dbt-cahnge-type-metadata-column/18790)

<div class="topic-metadata">

**Author:** [@jiohjeong98](https://discourse.getdbt.com/u/jiohjeong98)\
**Replies:** 0\
**Last updated:** [March 25, 2025, 1:26pm UTC](https://discourse.getdbt.com/t/snapshot-dbt-cahnge-type-metadata-column/18790 "2025-03-25T13:26:22Z")

</div>

The problem I’m having ive been wanting to bring in dbt\_change\_type metadata column in snapshot. In default\_\_snapshot\_staging\_table macro, dbt\_change\_type is created but its not brought into the final output The co…

---

## [Snapshot duplicates issue](https://discourse.getdbt.com/t/snapshot-duplicates-issue/18756)

<div class="topic-metadata">

**Author:** [@oli](https://discourse.getdbt.com/u/oli)\
**Replies:** 2\
**Last updated:** [March 24, 2025, 4:44am UTC](https://discourse.getdbt.com/t/snapshot-duplicates-issue/18756 "2025-03-24T04:44:18Z")

</div>

Help please, I have strictly followed the dbt snapshot documentation for creating a simple snapshot, but no matter what I try, I always ended up getting the below “duplication” error. 00:59:13 Completed with 1 error an…

---

## [How to declare the while loop and then to use that loop in different models, does it used in macro, kindly provide with an example](https://discourse.getdbt.com/t/how-to-declare-the-while-loop-and-then-to-use-that-loop-in-different-models-does-it-used-in-macro-kindly-provide-with-an-example/18536)

<div class="topic-metadata">

**Author:** [@jagadeesh9](https://discourse.getdbt.com/u/jagadeesh9)\
**Replies:** 3\
**Last updated:** [March 13, 2025, 11:28pm UTC](https://discourse.getdbt.com/t/how-to-declare-the-while-loop-and-then-to-use-that-loop-in-different-models-does-it-used-in-macro-kindly-provide-with-an-example/18536 "2025-03-13T23:28:29Z")

</div>

How to declare the while loop and then to use that loop in different models, does it used in macro, kindly provide with an example?

---

## [Ephemeral models, snapshots and new columns](https://discourse.getdbt.com/t/ephemeral-models-snapshots-and-new-columns/18421)

<div class="topic-metadata">

**Author:** [@rmontalegre](https://discourse.getdbt.com/u/rmontalegre)\
**Replies:** 0\
**Last updated:** [February 26, 2025, 10:58am UTC](https://discourse.getdbt.com/t/ephemeral-models-snapshots-and-new-columns/18421 "2025-02-26T10:58:47Z")

</div>

New columns in the source table cause error during snapshotting Expected behaviour: schema change where a new column is added is recognized and the new column is appended to the snapshot I’m currently having the problem …

---

## [How do I turn 2 years of source data into a snapshot table](https://discourse.getdbt.com/t/how-do-i-turn-2-years-of-source-data-into-a-snapshot-table/18314)

<div class="topic-metadata">

**Author:** [@BIBRO](https://discourse.getdbt.com/u/BIBRO)\
**Replies:** 0\
**Last updated:** [February 20, 2025, 2:02am UTC](https://discourse.getdbt.com/t/how-do-i-turn-2-years-of-source-data-into-a-snapshot-table/18314 "2025-02-20T02:02:25Z")

</div>

I have 2 years of source data that I want to turn into a scd2 but it seems that I have to run dbt build for each file in dbt that I have to iterate through all the files. If I run snapshot on all the files at once it re…

---

## [Snapshots are built with duplicate rows](https://discourse.getdbt.com/t/snapshots-are-built-with-duplicate-rows/9941)

<div class="topic-metadata">

**Author:** [@patryk](https://discourse.getdbt.com/u/patryk)\
**Replies:** 4\
**Last updated:** [February 4, 2025, 10:44pm UTC](https://discourse.getdbt.com/t/snapshots-are-built-with-duplicate-rows/9941 "2025-02-04T22:44:34Z")

</div>

I’m building snapshot models for reverse ETL scripts, so they pickup only recently changed rows. I don’t have any timestamp column available for this and I’m using “check all” strategy. The problem is, two of my snapsho…

---

## [Snapshot fails when new column added to schema](https://discourse.getdbt.com/t/snapshot-fails-when-new-column-added-to-schema/18031)

<div class="topic-metadata">

**Author:** [@rmontalegre](https://discourse.getdbt.com/u/rmontalegre)\
**Replies:** 0\
**Last updated:** [February 4, 2025, 8:47am UTC](https://discourse.getdbt.com/t/snapshot-fails-when-new-column-added-to-schema/18031 "2025-02-04T08:47:06Z")

</div>

Snapshots not automatically adding new column to snapshot table in databricks Docs indicate this should happen automatically FAQ on adding a new column to schema: What happens if I add new columns to my snapshot query? |…

---

## [1.9 snapshots fail in Databricks](https://discourse.getdbt.com/t/1-9-snapshots-fail-in-databricks/17429)

<div class="topic-metadata">

**Author:** [@martin\_larsson\_ellev](https://discourse.getdbt.com/u/martin_larsson_ellev)\
**Replies:** 1\
**Last updated:** [January 22, 2025, 10:00am UTC](https://discourse.getdbt.com/t/1-9-snapshots-fail-in-databricks/17429 "2025-01-22T10:00:46Z")

</div>

The problem I’m having We have started to utilize dbt core 1.9 and the new way of snapshots described in YAML. For our use case we needed to use an ephemeral model as relation to be able to filter our duplicates in the i…

---

## [SCD2 snapshot with multiple source joins](https://discourse.getdbt.com/t/scd2-snapshot-with-multiple-source-joins/17759)

<div class="topic-metadata">

**Author:** [@satish](https://discourse.getdbt.com/u/satish)\
**Replies:** 0\
**Last updated:** [January 17, 2025, 5:00pm UTC](https://discourse.getdbt.com/t/scd2-snapshot-with-multiple-source-joins/17759 "2025-01-17T17:00:44Z")

</div>

The problem I’m having i have a qurey joining party , address and email table and building dimension customer with sdc2 behavior , not in my case i have 3 tables as source and i may get change in only one table i.e email…

---

## [model version of a snapshot](https://discourse.getdbt.com/t/model-version-of-a-snapshot/17677)

<div class="topic-metadata">

**Author:** [@scfrouws](https://discourse.getdbt.com/u/scfrouws)\
**Replies:** 0\
**Last updated:** [January 9, 2025, 8:14am UTC](https://discourse.getdbt.com/t/model-version-of-a-snapshot/17677 "2025-01-09T08:14:02Z")

</div>

The problem I’m having I want to make a second model version of a snapshot table. And the versioned snapshot is not recognized. The context of why I’m trying to do this It’s for a spike/PoC for now, but the snapshot tab…

---

## [new snapshot meta columns defined in schema don't work](https://discourse.getdbt.com/t/new-snapshot-meta-columns-defined-in-schema-dont-work/17444)

<div class="topic-metadata">

**Author:** [@fraenzu](https://discourse.getdbt.com/u/fraenzu)\
**Replies:** 3\
**Last updated:** [December 23, 2024, 2:58pm UTC](https://discourse.getdbt.com/t/new-snapshot-meta-columns-defined-in-schema-dont-work/17444 "2024-12-23T14:58:55Z")

</div>

The renaming of the snapshot meta columns does not work. I wanted to create an scd-type2 like table. I am failing on two levels: the valid to date is still NULL even if I configured it to be 2999-12-31 the meta colum…

---

## [Compilation Error in snapshot invalid syntax for function call expression config(](https://discourse.getdbt.com/t/compilation-error-in-snapshot-invalid-syntax-for-function-call-expression-config/17157)

<div class="topic-metadata">

**Author:** [@lindazhou](https://discourse.getdbt.com/u/lindazhou)\
**Replies:** 1\
**Last updated:** [November 28, 2024, 3:24pm UTC](https://discourse.getdbt.com/t/compilation-error-in-snapshot-invalid-syntax-for-function-call-expression-config/17157 "2024-11-28T15:24:37Z")

</div>

The problem I’m having I’m running my code to try to work with snapshot in dbt core. I encountered this error saying invalid. Some example code or error messages in terminal dbt snapshot 12:48:29 Running with dbt=1.8.5…

---

## [Setting dbt\_valid\_from to NULL](https://discourse.getdbt.com/t/setting-dbt-valid-from-to-null/17152)

<div class="topic-metadata">

**Author:** [@skion](https://discourse.getdbt.com/u/skion)\
**Replies:** 2\
**Last updated:** [November 28, 2024, 1:43pm UTC](https://discourse.getdbt.com/t/setting-dbt-valid-from-to-null/17152 "2024-11-28T13:43:04Z")

</div>

One of the primary features of snapshots is to create a timeline of the underlying data. This is cool, since you can then find rows which were active at a certain point in time. A common query pattern we use is: select…

---

## [dbt snapshots throws compilation error](https://discourse.getdbt.com/t/dbt-snapshots-throws-compilation-error/17091)

<div class="topic-metadata">

**Author:** [@sowndarya666](https://discourse.getdbt.com/u/sowndarya666)\
**Replies:** 2\
**Last updated:** [November 26, 2024, 5:19pm UTC](https://discourse.getdbt.com/t/dbt-snapshots-throws-compilation-error/17091 "2024-11-26T17:19:01Z")

</div>

Compilation error I am trying to run my snapshots to track historic changes It throws error like "Compilation Error unexpected EOF, expected string, got “model\_name’) }} {% endsnapshot %}” my snapshot code {% snaps…

---

## [Mark "first" snapshot?](https://discourse.getdbt.com/t/mark-first-snapshot/16942)

<div class="topic-metadata">

**Author:** [@alevy](https://discourse.getdbt.com/u/alevy)\
**Replies:** 2\
**Last updated:** [November 11, 2024, 11:51pm UTC](https://discourse.getdbt.com/t/mark-first-snapshot/16942 "2024-11-11T23:51:06Z")

</div>

I’d like to treat the initial snapshot for a given source record differently in downstream queries in a performant fashion. I could certainly sub-select in my staging table on top of the snapshot table, but that seems in…

---

## [Snapshots - set dbt\_valid\_from to created\_at instead of updated\_at for initial snapshot?](https://discourse.getdbt.com/t/snapshots-set-dbt-valid-from-to-created-at-instead-of-updated-at-for-initial-snapshot/16941)

<div class="topic-metadata">

**Author:** [@alevy](https://discourse.getdbt.com/u/alevy)\
**Replies:** 0\
**Last updated:** [November 11, 2024, 7:23pm UTC](https://discourse.getdbt.com/t/snapshots-set-dbt-valid-from-to-created-at-instead-of-updated-at-for-initial-snapshot/16941 "2024-11-11T19:23:42Z")

</div>

I’m only now adding dbt snapshots for a source table which has existed for years. My source table has both created\_at and updated\_at timestamps, and I’ve configured the snapshot with the timestamp strategy using the upda…

---

## [DBT Snapshot has restarted and now has no dbt\_valid\_to NOT NULL rows.](https://discourse.getdbt.com/t/dbt-snapshot-has-restarted-and-now-has-no-dbt-valid-to-not-null-rows/16695)

<div class="topic-metadata">

**Author:** [@immediate\_jon](https://discourse.getdbt.com/u/immediate_jon)\
**Replies:** 0\
**Last updated:** [October 23, 2024, 9:42am UTC](https://discourse.getdbt.com/t/dbt-snapshot-has-restarted-and-now-has-no-dbt-valid-to-not-null-rows/16695 "2024-10-23T09:42:22Z")

</div>

The problem I’m having ------------------------------------------------------------------------------------------ I had a snapshot that worked, using the check strategy to pick up if anyone changes their email address wi…

---

## [Creating a custom 'check' strategy](https://discourse.getdbt.com/t/creating-a-custom-check-strategy/5996)

<div class="topic-metadata">

**Author:** [@dhan\_c](https://discourse.getdbt.com/u/dhan_c)\
**Replies:** 1\
**Last updated:** [October 2, 2024, 11:36am UTC](https://discourse.getdbt.com/t/creating-a-custom-check-strategy/5996 "2024-10-02T11:36:05Z")

</div>

Hi all, I’m trying to create a custom snapshot strategy which changes the way in which hard deletes are invalidated. I have created a custom check strategy by creating a new macro based off the original found here. Ho…

---

## [Creating snapshot in a custom location with Trino connector](https://discourse.getdbt.com/t/creating-snapshot-in-a-custom-location-with-trino-connector/16368)

<div class="topic-metadata">

**Author:** [@adalovelace](https://discourse.getdbt.com/u/adalovelace)\
**Replies:** 0\
**Last updated:** [October 1, 2024, 10:31am UTC](https://discourse.getdbt.com/t/creating-snapshot-in-a-custom-location-with-trino-connector/16368 "2024-10-01T10:31:33Z")

</div>

Hello. Is that possible to set a custom s3 location for my dbt snapshots? ( Im using iceberg+hive and I don’t want to enable random s3 locations on trino since it’s creating more problems for us in other models) the loc…

---

## [DBT Snapshot creating duplicate rows even though there's no change in source data](https://discourse.getdbt.com/t/dbt-snapshot-creating-duplicate-rows-even-though-theres-no-change-in-source-data/8223)

<div class="topic-metadata">

**Author:** [@Sreejit\_B](https://discourse.getdbt.com/u/Sreejit_B)\
**Replies:** 6\
**Last updated:** [September 27, 2024, 9:59am UTC](https://discourse.getdbt.com/t/dbt-snapshot-creating-duplicate-rows-even-though-theres-no-change-in-source-data/8223 "2024-09-27T09:59:05Z")

</div>

The problem I’m having I have an incremental model with snowflake incremental strategy delete+insert . Now there’s no if incremental logic defined yet. So basically the table works as full refresh everytime. And everytim…

---

## [dbt snapshot fails](https://discourse.getdbt.com/t/dbt-snapshot-fails/5292)

<div class="topic-metadata">

**Author:** [@daria\_a](https://discourse.getdbt.com/u/daria_a)\
**Replies:** 7\
**Last updated:** [September 18, 2024, 9:41am UTC](https://discourse.getdbt.com/t/dbt-snapshot-fails/5292 "2024-09-18T09:41:36Z")

</div>

Hi, I get snapshop datatypes error Value has type STRUCT\<module STRING, reference\_entity\_class STRING, reference\_table STRING, ...\> which cannot be inserted into column created\_by, which has type STRUCT\<module STRING, …

---

## [Recreate SCD2 table with snapshots](https://discourse.getdbt.com/t/recreate-scd2-table-with-snapshots/15297)

<div class="topic-metadata">

**Author:** [@oliveirajo](https://discourse.getdbt.com/u/oliveirajo)\
**Replies:** 3\
**Last updated:** [September 17, 2024, 1:46pm UTC](https://discourse.getdbt.com/t/recreate-scd2-table-with-snapshots/15297 "2024-09-17T13:46:04Z")

</div>

Unable to recreate SCD2 table (updated\_At, valid\_from, valid\_to with todays date) Hello, we are migrating our ETL jobs to dbt, and we are on the point where we need/want to migrate our scd2 tables. Wondering what can b…

[Next page](https://discourse.getdbt.com/tag/snapshots/11.md?match_all_tags=true&page=1&tags%5B%5D=snapshots)
