Bird
0
0

Consider this dbt model snippet:

medium📝 Predict Output Q4 of 15
dbt - Incremental Models
Consider this dbt model snippet:
{% if is_incremental() %}
  SELECT * FROM source_table WHERE created_at > (SELECT MAX(created_at) FROM {{ this }})
{% else %}
  SELECT * FROM source_table
{% endif %}

What data will be inserted during an incremental run?
ARows with <code>created_at</code> less than the max in the target table
BAll rows from <code>source_table</code> regardless of <code>created_at</code>
CNo rows will be inserted during incremental runs
DOnly rows with <code>created_at</code> greater than the max in the existing target table
Step-by-Step Solution
Solution:
  1. Step 1: Understand the condition

    During incremental runs, the query filters rows where created_at is greater than the max created_at in the existing table.
  2. Step 2: Behavior

    This ensures only new rows since the last run are inserted.
  3. Final Answer:

    Only rows with created_at greater than the max in the existing target table -> Option D
  4. Quick Check:

    Check the WHERE clause condition [OK]
Quick Trick: Filters new rows by timestamp during incremental runs [OK]
Common Mistakes:
MISTAKES
  • Assuming all rows are inserted during incremental runs
  • Thinking no rows are inserted incrementally
  • Misreading the comparison operator in WHERE clause

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes