Bird
0
0

Consider this dbt merge config:

medium📝 Predict Output Q5 of 15
dbt - Incremental Models

Consider this dbt merge config:

merge:
  unique_key: ['customer_id', 'transaction_date']

What is the effect of using a composite unique_key here?

ARows are matched if either customer_id or transaction_date matches
BRows are matched only if both customer_id and transaction_date match
COnly customer_id is used for matching, transaction_date ignored
DThe merge will fail because composite keys are not supported
Step-by-Step Solution
Solution:
  1. Step 1: Understand composite unique_key behavior

    Composite keys require all listed columns to match for row identification.
  2. Step 2: Eliminate incorrect options

    Matching on either column or ignoring one is incorrect; composite keys are supported.
  3. Final Answer:

    Rows are matched only if both customer_id and transaction_date match -> Option B
  4. Quick Check:

    Composite keys require all columns to match [OK]
Quick Trick: Composite unique_key matches rows on all listed columns [OK]
Common Mistakes:
MISTAKES
  • Thinking matching on any one column is enough
  • Assuming composite keys are unsupported
  • Ignoring one column in composite key

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes