Bird
0
0

Why does dbt snapshot use a unique_key instead of a primary key constraint to track records?

hard🧠 Conceptual Q10 of 15
dbt - Advanced Patterns
Why does dbt snapshot use a unique_key instead of a primary key constraint to track records?
ABecause primary keys are not supported in snapshot tables
BBecause unique_key identifies records logically without enforcing database constraints
CBecause unique_key automatically creates indexes
DBecause primary keys cause snapshot failures
Step-by-Step Solution
Solution:
  1. Step 1: Understand unique_key role in snapshots

    Unique_key identifies records logically for tracking changes but does not enforce database constraints.
  2. Step 2: Clarify difference from primary keys

    Primary keys are database constraints; snapshots do not require or enforce these constraints.
  3. Step 3: Evaluate other options

    Primary keys are supported but not required. Unique_key does not create indexes automatically. Primary keys do not cause failures inherently.
  4. Final Answer:

    Because unique_key identifies records logically without enforcing database constraints -> Option B
  5. Quick Check:

    Unique_key = logical record ID, not DB constraint [OK]
Quick Trick: Unique_key tracks records logically, not as DB constraint [OK]
Common Mistakes:
MISTAKES
  • Confusing unique_key with primary key constraint
  • Assuming unique_key creates indexes
  • Believing primary keys cause snapshot errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes