Bird
0
0

Given this dbt model config and SQL, what will be the result when run?

medium📝 Predict Output Q13 of 15
dbt - Performance Optimization
Given this dbt model config and SQL, what will be the result when run?
{% if is_incremental() %}
  select * from source_table where updated_at > (select max(updated_at) from {{ this }})
{% else %}
  select * from source_table
{% endif %}

Model config:
materialized: 'incremental'
AThe model will fully refresh the table every run.
BThe model will fail due to syntax error.
CThe model will create a view instead of a table.
DThe model will add only new rows with updated timestamps.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the incremental logic in SQL

    The SQL uses is_incremental() to run different queries: full select on first run, then only new rows after.
  2. Step 2: Match with incremental materialization behavior

    With materialized: 'incremental', dbt appends new rows where updated_at is greater than the max in the existing table.
  3. Final Answer:

    The model will add only new rows with updated timestamps. -> Option D
  4. Quick Check:

    Incremental model adds new rows only [OK]
Quick Trick: Incremental models append new data, not full refresh [OK]
Common Mistakes:
MISTAKES
  • Thinking incremental always refreshes full table
  • Confusing view creation with incremental
  • Ignoring the is_incremental() condition

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes