How to Full Refresh Incremental Model in dbt: Simple Guide
To full refresh an incremental model in dbt, run
dbt run --full-refresh. This command drops the existing incremental table and rebuilds it completely from the source data, ensuring a fresh start.Syntax
The command to full refresh an incremental model in dbt is simple:
dbt run --full-refresh: Runs all models, rebuilding incremental models from scratch.
This flag tells dbt to drop the existing incremental table and recreate it fully instead of just adding new data.
bash
dbt run --full-refresh
Example
This example shows how to run a full refresh on an incremental model named my_incremental_model. First, ensure your model is configured as incremental in its SQL file.
Then run the command below in your terminal inside your dbt project folder.
bash
dbt run --models my_incremental_model --full-refresh
Output
Running with dbt=1.4.6
Found 1 model, 0 tests, 0 snapshots, 0 analyses, 0 macros, 0 operations
Starting full-refresh of incremental model 'my_incremental_model'...
Finished running 1 model in 12.3s.
Completed successfully
Common Pitfalls
Common mistakes when trying to full refresh incremental models include:
- Not using the
--full-refreshflag, which only appends new data instead of rebuilding. - Running
dbt runwithout specifying models, which refreshes all models and can be slow. - Forgetting to configure the model as
incrementalin the model SQL file.
Always check your model config and use the correct command to avoid partial refreshes.
bash
/* Wrong way: This only appends data, no full refresh */ dbt run --models my_incremental_model /* Right way: Full refresh rebuilds the table */ dbt run --models my_incremental_model --full-refresh
Quick Reference
| Command | Description |
|---|---|
| dbt run --full-refresh | Full rebuild of all incremental models |
| dbt run --models | Full rebuild of specific incremental model |
| dbt run | Runs models normally, incremental models append data |
| --models | Run only specified model(s) |
Key Takeaways
Use
dbt run --full-refresh to fully rebuild incremental models.Add
--models model_name to target specific models for refresh.Without
--full-refresh, incremental models only append new data.Ensure your model is configured as incremental in the SQL file.
Full refresh drops and recreates the table, so use carefully on large datasets.