dbt
dbt Full Refresh Command

dbt full refresh: Managing Full Refreshes in dbt

In dbt, the full_refresh configuration allows you to control whether models and seeds should fully refresh during a dbt run or dbt seed command. This setting specifies refresh behavior for specific resources within your dbt project.

Configuring Full Refresh for Models

You can set the full_refresh option in dbt_project.yml or directly within model SQL files to manage refresh behavior:

dbt_project.yml

_10
models:
_10
<resource-path>:
_10
+full_refresh: false # Disables full-refresh for models in this path

models/model_name.sql

_10
{{ config(
_10
full_refresh = false # Prevents full-refresh when --full-refresh is invoked
_10
) }}
_10
_10
SELECT ...

Full Refresh for Seeds

Seeds can also be configured to ignore the --full-refresh flag:

dbt_project.yml

_10
seeds:
_10
<resource-path>:
_10
+full_refresh: false

Full Refresh Logic

  • true: Resource always full-refreshes with --full-refresh.
  • false: Resource never full-refreshes, regardless of --full-refresh flag.
  • none or omitted: Follows the --full-refresh flag behavior.

Rebuilding Incremental Models

To force a full refresh on incremental models when logic changes:


_10
$ dbt run --full-refresh --select incremental_model_name

Handling Schema Changes in Incremental Models

Use on_schema_change in incremental models to manage schema modifications:

dbt_project.yml

_10
models:
_10
+on_schema_change: "sync_all_columns"

models/model_name.sql:

_10
{{
_10
config(
_10
materialized='incremental',
_10
unique_key='date_day',
_10
on_schema_change='append_new_columns'
_10
)
_10
}}

Options for on_schema_change:

  • ignore: Default behavior continues.
  • fail: Errors out if schemas differ.
  • append_new_columns: Adds new columns without removing absent ones.
  • sync_all_columns: Adds and removes columns, including data type changes.
Y42 Lineage Mode

Manage Sources and dbt Models in one place

Build end-to-end pipelines using a single framework.

Get Started