0
0
dbtdata~5 mins

is_incremental() macro in dbt - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the is_incremental() macro do in dbt?
The is_incremental() macro checks if the current dbt run is an incremental run, meaning it only processes new or changed data instead of rebuilding the entire table.
Click to reveal answer
beginner
Why use is_incremental() in a dbt model?
You use is_incremental() to write logic that runs only during incremental runs, allowing you to add new data without rebuilding the whole dataset, saving time and resources.
Click to reveal answer
intermediate
Example usage of is_incremental() in a dbt SQL model?
Inside your model SQL, you can write:<br>
select * from source_table<br>{% if is_incremental() %}<br>where updated_at > (select max(updated_at) from {{ this }})<br>{% endif %}
This means only new or updated rows are added during incremental runs.
Click to reveal answer
beginner
What happens if you don't use is_incremental() in an incremental model?
If you don't use is_incremental(), your model will rebuild the entire table every time, losing the benefits of incremental loading and increasing run time.
Click to reveal answer
intermediate
Can is_incremental() be used outside incremental models?
No, is_incremental() returns false in full-refresh or non-incremental runs, so its logic only applies when the model is set to incremental mode.
Click to reveal answer
What does is_incremental() return during a full-refresh run?
ATrue
BDepends on the model
CAn error
DFalse
Why is is_incremental() useful in dbt models?
ATo check if the model is running in incremental mode
BTo speed up full-refresh runs
CTo delete old data automatically
DTo create new tables
Which of these is a common use of is_incremental() in SQL?
ADropping tables before loading
BFiltering rows to only new or updated data
CCreating indexes
DChanging column types
If you want your model to always rebuild fully, what should is_incremental() return?
ANull
BTrue
CFalse
DDepends on the data
What happens if you use incremental logic without checking is_incremental()?
AThe model may miss data or error
BThe model creates duplicate tables
CThe model runs faster
DNothing changes
Explain what the is_incremental() macro does and why it is important in dbt incremental models.
Think about how incremental models avoid rebuilding everything.
You got /3 concepts.
    Describe a simple example of how you would use is_incremental() in a dbt model SQL file.
    Consider filtering data to only new rows during incremental loads.
    You got /3 concepts.