Bird
0
0

Which of the following is the correct way to specify a composite unique_key in a dbt model's merge config?

easy📝 Syntax Q12 of 15
dbt - Incremental Models

Which of the following is the correct way to specify a composite unique_key in a dbt model's merge config?

merge:
  unique_key: ?
A['id', 'date']
B'id, date'
C{id, date}
Did + date
Step-by-Step Solution
Solution:
  1. Step 1: Recall syntax for composite unique_key

    dbt expects a list of column names for composite keys, written as ['col1', 'col2'].
  2. Step 2: Match syntax options

    ['id', 'date'] uses a list syntax with square brackets and quotes, which is correct.
  3. Final Answer:

    ['id', 'date'] -> Option A
  4. Quick Check:

    Composite unique_key = list of columns [OK]
Quick Trick: Use list syntax ['col1', 'col2'] for composite keys [OK]
Common Mistakes:
MISTAKES
  • Using a string with commas instead of a list
  • Using curly braces which is invalid syntax
  • Trying to add columns with + operator

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes