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?✗ Incorrect
is_incremental() returns false during full-refresh runs because the model rebuilds fully, not incrementally.Why is
is_incremental() useful in dbt models?✗ Incorrect
is_incremental() helps you write code that runs only during incremental loads, improving efficiency.Which of these is a common use of
is_incremental() in SQL?✗ Incorrect
You use
is_incremental() to filter data so only new or changed rows are processed during incremental runs.If you want your model to always rebuild fully, what should
is_incremental() return?✗ Incorrect
During full rebuilds,
is_incremental() returns false, meaning incremental logic is skipped.What happens if you use incremental logic without checking
is_incremental()?✗ Incorrect
Without checking
is_incremental(), incremental logic might run during full-refresh causing errors or missing data.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.