Skip to content

Commit 281c438

Browse files
authored
Merge pull request #116 from dbt-labs/feat/snapshots_refactor
Refactor snapshots to new method as of dbt core 1.9
2 parents f348361 + 833d85c commit 281c438

File tree

7 files changed

+53
-81
lines changed

7 files changed

+53
-81
lines changed

models/_samples/snapshot/example_join_snapshots.sql renamed to models/_samples/snapshot/example_join_snapshots.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
with order_snapshot as (
1+
{# with order_snapshot as (
22
select
33
* exclude dbt_valid_to,
44
coalesce(dbt_valid_to, cast('{{ var("future_proof_date") }}' as timestamp)) as dbt_valid_to
@@ -47,3 +47,4 @@ final as (
4747
)
4848

4949
select * from final
50+
#}

snapshots/_samples/example_generate_schema_snapshot.sql

Lines changed: 0 additions & 14 deletions
This file was deleted.

snapshots/_samples/example_orders_line_items_snapshot.sql

Lines changed: 0 additions & 14 deletions
This file was deleted.

snapshots/_samples/example_orders_snapshot.sql

Lines changed: 0 additions & 14 deletions
This file was deleted.

snapshots/jaffle_snapshots.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
version: 2
2+
3+
snapshots:
4+
# This is a pretty standard snapshot
5+
- name: snapshot_stg_payments
6+
relation: source('stripe', 'payment')
7+
config:
8+
enabled: true
9+
strategy: timestamp
10+
updated_at: _BATCHED_AT
11+
unique_key: ID
12+
persist_docs:
13+
relation: true
14+
columns: true
15+
# Another standard snapshot but this time with a different table.
16+
- name: snapshot_example_orders
17+
relation: ref('example_orders_source_for_snapshot')
18+
config:
19+
enabled: true
20+
strategy: timestamp
21+
updated_at: order_updated_at
22+
unique_key: order_id
23+
persist_docs:
24+
relation: true
25+
columns: true
26+
invalidate_hard_deletes: true
27+
28+
# This snapshot has the check_cols example
29+
- name: snapshot_int_line_items
30+
relation: ref('int_line_items_amounts_calculated')
31+
config:
32+
enabled: true
33+
strategy: check
34+
check_cols: ['gross_item_sales_amount', 'net_item_sales_amount']
35+
unique_key: order_item_id
36+
persist_docs:
37+
relation: true
38+
columns: true
39+
# This snapshot has invalidate hard deletes as an example
40+
- name: snapshot_orders_line_items
41+
relation: ref('example_orders_line_items_source_for_snapshot')
42+
config:
43+
enabled: true
44+
strategy: timestamp
45+
unique_key: id
46+
updated_at: order_updated_at
47+
invalidate_hard_deletes: true
48+
persist_docs:
49+
relation: true
50+
columns: true
51+

snapshots/snapshot_int_line_items.sql

Lines changed: 0 additions & 22 deletions
This file was deleted.

snapshots/snapshot_stg_payments.sql

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)