Bird
0
0

You wrote this incremental model using delete+insert:

medium📝 Debug Q6 of 15
dbt - Incremental Models
You wrote this incremental model using delete+insert:
{{ config(materialized='incremental', incremental_strategy='delete+insert', unique_key='id') }}
select id, value from source_table

After running, you notice duplicate rows in the target table. What is the likely cause?
AThe incremental_strategy parameter is misspelled
BThe model should use append strategy instead
CThe source_table has duplicate rows causing duplicates
DThe unique_key is missing or incorrect, so delete does not remove all matching rows
Step-by-Step Solution
Solution:
  1. Step 1: Understand delete+insert with unique_key

    Delete+insert deletes rows matching unique_key before inserting new data.
  2. Step 2: Diagnose duplicates cause

    If unique_key is missing or wrong, delete won't remove all duplicates, causing duplicates to remain.
  3. Final Answer:

    The unique_key is missing or incorrect, so delete does not remove all matching rows -> Option D
  4. Quick Check:

    Correct unique_key needed for delete+insert to avoid duplicates [OK]
Quick Trick: Always set correct unique_key for delete+insert strategy [OK]
Common Mistakes:
MISTAKES
  • Ignoring unique_key importance
  • Switching strategy without fixing keys
  • Blaming source data without checking keys

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes