How to Write Incremental Models in dbt

Last updated July 25, 2026 · By the SaturnSQL team

Set materialized='incremental' and wrap a filter in {% if is_incremental() %} so subsequent runs only process new rows. Add unique_key so changed rows are updated rather than duplicated, and pick an incremental_strategy like merge or delete+insert.

{{ config(
    materialized='incremental',
    unique_key='event_id',
    incremental_strategy='merge'
) }}

SELECT * FROM {{ source('app', 'events') }}
{% if is_incremental() %}
WHERE event_time > (SELECT MAX(event_time) FROM {{ this }})
{% endif %}

How it behaves

On the first run (or with --full-refresh) the whole SELECT builds the table and is_incremental() is false. On later runs the filter applies and dbt merges results into the existing table using unique_key. Available strategies (append, merge, delete+insert, insert_overwrite, microbatch) depend on the adapter.

Run this in SaturnSQL

SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.

Try it free

Related dbt guides

© 2026 Panda Capital Oy Ab. All rights reserved.