Bird
0
0

You want to create a dbt incremental model that updates existing rows if data has changed and inserts new rows. Which strategy should you implement?

hard📝 Application Q8 of 15
dbt - Incremental Models

You want to create a dbt incremental model that updates existing rows if data has changed and inserts new rows. Which strategy should you implement?

ARun a full refresh every time to replace the table
BSimply append all rows without filtering or updating existing data
CUse <code>is_incremental()</code> with a <code>merge</code> or <code>update</code> statement to handle inserts and updates
DUse a view materialization instead of incremental
Step-by-Step Solution
Solution:
  1. Step 1: Understand incremental update needs

    To update existing rows and insert new ones, you need logic to merge changes.
  2. Step 2: Use is_incremental() block

    Within this block, implement SQL merge or update statements to handle changes.
  3. Final Answer:

    Use is_incremental() with a merge or update statement to handle inserts and updates -> Option C
  4. Quick Check:

    Use is_incremental() with merge/update for upserts [OK]
Quick Trick: Use is_incremental() with merge for updates and inserts [OK]
Common Mistakes:
MISTAKES
  • Appending without update logic causing duplicates
  • Relying on full refresh for incremental needs
  • Using view materialization which doesn't support incremental

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes