Bird
0
0

What will be the effect of running this dbt incremental model for the second time?

medium📝 Predict Output Q4 of 15
dbt - Incremental Models
What will be the effect of running this dbt incremental model for the second time?
{{ config(materialized='incremental') }}
select * from source_table where updated_at > (select max(updated_at) from {{ this }})
AAll rows from source_table will be reprocessed and replaced
BOnly new rows with updated_at greater than the last max updated_at in the model will be appended
CThe model will fail due to a syntax error in the where clause
DThe model will delete all existing rows before inserting new data
Step-by-Step Solution
Solution:
  1. Step 1: Understand incremental logic

    The model filters source_table rows where updated_at is greater than the max updated_at already in the model.
  2. Step 2: Effect on second run

    On the second run, only rows with updated_at newer than the last max updated_at will be appended, avoiding full reload.
  3. Final Answer:

    Only new rows with updated_at greater than the last max updated_at in the model will be appended -> Option B
  4. Quick Check:

    Incremental models append new data based on max timestamp [OK]
Quick Trick: Incremental models append only newer data [OK]
Common Mistakes:
MISTAKES
  • Assuming full table reload happens every run
  • Confusing incremental filter logic
  • Believing the model deletes existing data

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes