Static analysis tool that warns about risky DDL changes before dbt run. Like terraform plan for dbt.
pip install dbt-plan
dbt-plan run
dbt-plan ci-setup
.github/workflows/dbt-plan.yml with snapshot, check, and merge gate.dbt-plan ci-setup
git add .github/workflows/dbt-plan.yml git push
| Command | What it does |
|---|---|
| dbt-plan run | One command: compile baseline, compile current, check. Handles git stash automatically. |
| dbt-plan check | Analyze compiled SQL changes and warn about risks. Supports --format text/github/json, --select. |
| dbt-plan snapshot | Save current compiled SQL + manifest as baseline for later comparison. |
| dbt-plan ci-setup | Generate GitHub Actions workflow that runs dbt-plan on every PR. |
| dbt-plan init | Generate .dbt-plan.yml config + add .dbt-plan/ to .gitignore. |
| dbt-plan stats | Analyze project: materialization distribution, SELECT * usage, cascade risks. |
.dbt-plan.yml in your project root, or use environment variables.# .dbt-plan.yml # Skip known-safe models ignore_models: [scratch_model, staging_temp] # SQL dialect (default: snowflake) dialect: bigquery # Custom compile command (for uv, poetry, etc.) compile_command: uv run dbt compile # Exit code for warnings (default: 2, set 0 to pass CI) warning_exit_code: 0
DBT_PLAN_DIALECT=bigquery DBT_PLAN_COMPILE_COMMAND="uv run dbt compile" DBT_PLAN_IGNORE_MODELS="scratch_model,staging_temp" DBT_PLAN_FORMAT=json DBT_PLAN_WARNING_EXIT_CODE=0
| Principle | Meaning |
|---|---|
| False safe = never | If we can't determine safety, we warn. Never silently pass. |
| False warning = OK | Over-warning is fine. Use ignore_models to suppress. |
| No runtime deps | Only sqlglot. No warehouse connection needed. |
| CI-first | Exit codes, structured output, one-line summary. |