SpinTheMic
Pro

dbt · Intermediate

How do incremental models work in dbt?

By Anurag Pandey, Lead Data Engineer ·

The short answer

On the first run dbt builds the whole table. On later runs, the is_incremental() block filters the source to new or changed rows, and dbt inserts or merges them into the existing table, matching on unique_key if you set one.

Practice this out loud

Opens this question on SpinTheMic. Start without signing up; sign in free for an AI report card.

Say it like this

About 50 seconds out loud. Use it as a model, then put it in your own words.

An incremental model builds the full table the first time it runs. After that, dbt only processes new or changed rows. In the SQL, I wrap a filter in an is_incremental() block, for example: only take rows where updated_at is later than the latest updated_at already in {{ this }}, which is the existing table. is_incremental() is only true when the table already exists, the model is incremental, and I didn't pass --full-refresh. If I set a unique_key, dbt updates matching rows instead of adding duplicates, using a strategy like merge or delete+insert, depending on the warehouse. The classic trap is late data: a strict max timestamp filter misses rows that arrive late, so I usually add a lookback window of a few hours or days.

What interviewers look for

  • You explain is_incremental() and when it is true.
  • You know what unique_key does and that strategies depend on the adapter.
  • You bring up late-arriving data without being asked.

Common mistakes

  • Forgetting the first run builds everything, so the filter must be inside is_incremental().
  • Assuming unique_key fixes everything. It can't merge rows your filter never selected.
  • Never planning for a full refresh when the logic or schema changes.

Follow-up questions to expect

  1. 1Which incremental strategies does your warehouse support?
  2. 2What does on_schema_change do?
  3. 3How would you backfill one month of an incremental model?
Practice this out loud

Opens this question on SpinTheMic. Start without signing up; sign in free for an AI report card.

Checked against

All interview question guides