Recall & Review
beginner
What is a unique key in the context of merge behavior in dbt?
A unique key is a column or set of columns that uniquely identify each row in a table. It helps dbt know which rows to update or insert during a merge operation.
Click to reveal answer
beginner
Why is specifying a unique key important for merge operations in dbt?
Specifying a unique key ensures that dbt can correctly match existing rows to update them and avoid duplicate rows when merging new data.
Click to reveal answer
intermediate
What happens if you do not specify a unique key in a dbt merge operation?
Without a unique key, dbt cannot reliably match rows, which may cause errors or duplicate data during the merge.
Click to reveal answer
intermediate
How do you define a unique key in a dbt model for merge behavior?
You define the unique key in the model's config block using the unique_key parameter, listing the column(s) that uniquely identify rows.
Click to reveal answer
beginner
Give an example of a unique key configuration in a dbt model.
Example: {{ config(materialized='incremental', unique_key='id') }} means the 'id' column uniquely identifies each row for merge.
Click to reveal answer
What does the unique key do in a dbt merge operation?
✗ Incorrect
The unique key helps dbt match rows to update or insert during a merge.
What might happen if you omit the unique key in a dbt incremental model?
✗ Incorrect
Without a unique key, dbt cannot match rows properly, causing duplicates or errors.
How do you specify a unique key in a dbt model?
✗ Incorrect
You specify the unique key in the config block using the 'unique_key' parameter.
Which of these is a good choice for a unique key?
✗ Incorrect
A unique key must uniquely identify each row to work correctly.
In dbt, what type of model typically uses a unique key for merge behavior?
✗ Incorrect
Incremental models use unique keys to merge new data with existing data.
Explain why a unique key is necessary for merge behavior in dbt incremental models.
Think about how dbt knows which rows to change or add.
You got /4 concepts.
Describe how to set a unique key in a dbt model and what happens if it is missing.
Focus on the config syntax and consequences.
You got /3 concepts.