dbt-autofix

raw JSON →
0.20.4 verified Fri May 01 auth: no python

dbt-autofix is a CLI tool that automatically fixes deprecations and breaking changes in dbt projects. It scans your dbt models, tests, and configurations and applies transformations to migrate to newer versions of dbt. Current version: 0.20.4, requires Python >=3.10, <3.14. Release cadence is irregular with frequent patch releases.

pip install dbt-autofix
error ModuleNotFoundError: No module named 'dbt_autofix'
cause The package is a CLI tool and not designed to be imported as a library. This error occurs when trying `import dbt_autofix`.
fix
Use the CLI directly: pip install dbt-autofix then run dbt-autofix from the command line. Do not import in Python scripts.
error Error: Invalid value for '--apply': dbt-autofix: error: no such option: --apply
cause The `--apply` flag was renamed to `--write` in version 0.20.0. Using outdated flags causes errors.
fix
Replace --apply with --write. Run dbt-autofix run --help for current options.
error RuntimeError: dbt project not found. Make sure you are in a dbt project directory.
cause dbt-autofix must be run from inside a dbt project directory containing dbt_project.yml.
fix
Navigate to your dbt project root (where dbt_project.yml resides) before running dbt-autofix.
gotcha Always run with --dry-run first. dbt-autofix modifies files in-place; without dry-run you might lose original code.
fix Run `dbt-autofix --dry-run` before `dbt-autofix --apply`.
breaking In version 0.20.0, the CLI changed from `dbt-autofix` to `dbt-autofix run` or subcommands. Older scripts using the old syntax will break.
fix Update commands to use `dbt-autofix run` or refer to the new CLI structure. Check `dbt-autofix --help`.
deprecated The `--config` flag for custom configuration files was deprecated in 0.18.0 and removed in 0.20.0. Use `--project-dir` and custom profiles instead.
fix Remove `--config` flags; use `--project-dir` for project path and configure via `profiles.yml`.
gotcha dbt-autofix may incorrectly fix deprecations in macros if macro arguments are not properly handled. Always review diff output.
fix Manually review any changes to macros after autofix. Use version control to revert if needed.
pip install dbt-autofix==0.20.4

Install the tool, navigate to your dbt project directory, run a dry-run to see changes, then apply fixes.

pip install dbt-autofix
cd /path/to/your/dbt/project
# Run autofix on all models (dry-run first)
dbt-autofix --dry-run
# Apply fixes
dbt-autofix --apply