0
0
dbtdata~10 mins

Snapshot tables for historical tracking in dbt - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a snapshot in dbt.

dbt
snapshot my_snapshot {
  [1]: 'my_source_table'
  strategy: timestamp
  updated_at: updated_at_column
}
Drag options to blanks, or click blank then click option'
Atable
Btarget
Csource
Ddatabase
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'target' instead of 'source' causes dbt to fail to find the input table.
Confusing 'table' or 'database' as the keyword.
2fill in blank
medium

Complete the code to specify the snapshot strategy in dbt.

dbt
snapshot my_snapshot {
  source: 'my_source_table'
  strategy: [1]
  updated_at: updated_at_column
}
Drag options to blanks, or click blank then click option'
Atimestamp
Bmerge
Cincremental
Dappend
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'merge' which is not a valid snapshot strategy in dbt.
Confusing 'incremental' with snapshot strategies.
3fill in blank
hard

Fix the error in the snapshot config to correctly track changes by unique key.

dbt
snapshot my_snapshot {
  source: 'my_source_table'
  strategy: check
  unique_key: [1]
}
Drag options to blanks, or click blank then click option'
Aupdated_at_column
Bid_column
Cmerge_key
Dtimestamp_column
Attempts:
3 left
💡 Hint
Common Mistakes
Using a timestamp column as unique_key causes incorrect snapshot behavior.
Using a non-unique column leads to duplicate records.
4fill in blank
hard

Fill both blanks to create a snapshot that uses the 'check' strategy and tracks changes by 'email' column.

dbt
snapshot user_email_snapshot {
  source: 'users'
  strategy: [1]
  unique_key: [2]
}
Drag options to blanks, or click blank then click option'
Acheck
Btimestamp
Cemail
Did
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'timestamp' strategy with 'email' unique key is inconsistent.
Using 'id' instead of 'email' when the task specifies email.
5fill in blank
hard

Fill all three blanks to define a snapshot with 'timestamp' strategy, track by 'last_modified', and use 'user_id' as unique key.

dbt
snapshot user_activity_snapshot {
  source: [1]
  strategy: [2]
  unique_key: [3]
  updated_at: last_modified
}
Drag options to blanks, or click blank then click option'
A'user_activity'
Btimestamp
Cuser_id
D'users'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong table name for source.
Confusing unique_key with updated_at column.