Bird
0
0

What is the expected output when running an incremental model with this condition?

medium📝 Predict Output Q5 of 15
dbt - Incremental Models
What is the expected output when running an incremental model with this condition?
{{ config(materialized='incremental') }}
select * from sales where order_date > (select max(order_date) from {{ this }})

Assuming the existing model has max order_date '2023-05-01' and source has orders up to '2023-05-10'.
AThe model will delete existing data
BAll orders including '2023-05-01' will be reloaded
COnly orders from '2023-05-02' to '2023-05-10' will be added
DNo new orders will be added
Step-by-Step Solution
Solution:
  1. Step 1: Identify max order_date in existing data

    Max order_date is '2023-05-01' in the current model.
  2. Step 2: Apply filter condition

    Query selects orders with order_date greater than '2023-05-01', so orders from '2023-05-02' to '2023-05-10' are added.
  3. Final Answer:

    Only orders from '2023-05-02' to '2023-05-10' will be added -> Option C
  4. Quick Check:

    Incremental adds only newer dates [OK]
Quick Trick: Incremental adds data after max existing date [OK]
Common Mistakes:
MISTAKES
  • Including max date in new data
  • Assuming all data reloads
  • Thinking model deletes data

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes