CLI to autofix deprecations in dbt projects
Project description
dbt-autofix (previously dbt-cleanup)
dbt-autofix automatically scans your dbt project for deprecated configurations and updates them to align with the latest best practices. This makes it easier to resolve deprecation warnings introduced in dbt v1.10 as well as prepare for migration to the dbt Fusion engine.
| Deprecation Code in dbt Core | Files | Description |
|---|---|---|
CustomKeyInObjectDeprecation |
YAML files | Move all models configs under config: in YAML files |
CustomKeyInObjectDeprecation |
YAML files | Move all models extra config (not valid or custom) under meta: and meta under config: |
DuplicateYAMLKeysDeprecation |
YAML files | Remove duplicate keys in YAML files, keeping the second one to keep the same behaviour |
| - | YAML files | Only allow email and name as properties for groups and exposures owners |
UnexpectedJinjaBlockDeprecation |
SQL files | Remove extra {% endmacro %} and {% endif %} that don't have corresponding opening statements |
| - | dbt_project.yml |
Prefix all configs for modeles/tests etc... with a + |
ConfigDataPathDeprecation |
dbt_project.yml |
Remove deprecated config for data path (now seed) |
ConfigLogPathDeprecation |
dbt_project.yml |
Remove deprecated config for log path |
ConfigSourcePathDeprecation |
dbt_project.yml |
Remove deprecated config for source path |
ConfigTargetPathDeprecation |
dbt_project.yml |
Remove deprecated config for target path |
Installation
From PyPi
We recommend using uv/uvx to run the package.
If you don't have uv installed, you can install uv and uvx, following the instructions on the offical website.
- to run the latest version of the tool:
uvx dbt-autofix - to run a specific version of the tool:
uvx dbt-autofix@0.1.2 - to install the tool as a dedicated CLI:
uv tool install dbt-autofix
You can also use pip if you prefer, but we then recommend installing the tool in its own Python virtual environment. Once in a venv, install the tool with pip install dbt-autofix and then run dbt-autofix ...
From the source repo
To run it from the git repo directly, install uv following those instructions and then:
run the tool directly
uvx --from git+https://github.com/dbt-labs/dbt-autofix.git dbt-autofix --help
or install it so that it can be run with dbt-cleanup in the future
uv tool install --from git+https://github.com/dbt-labs/dbt-autofix.git dbt-autofix
Usage
deprecations - the main one
dbt-autofix deprecations: refactor YAML and SQL files to fix some deprecations- add
--path <mypath>to configure the path of the dbt project (defaults to.) - add
--dry-runfor running in dry run mode - add
--jsonto get resulting data in a JSONL format - add
--json-schema-version v2.0.0-beta.4to get the JSON schema from a specific Fusion release (by default we pick the latest) - add
--select <path>to only select files in a given path (by default the tool will look at all files of the dbt project)
- add
Each JSON object will have the following keys:
- "mode": "applied" or "dry_run"
- "file_path": the full path of the file modified. Each file will appear only once
- "refactors": the list of refactoring rules applied
Calling deprecations without --dry-run should be safe if your dbt code is part of a git repo.
Please review the suggested changes to your dbt project before merging to main and make those changes go through your typical CI/CD process.
jobs
dbt-autofix jobs: update dbt platform jobs steps to use -s/--select selectors instead of -m/--models/--model which are deprecated in the Fusion engine
Run dbt-autofix jobs --help to see the required parameters and supported arguments.
This tool requires connecting to the dbt Admin API to retrieve and update jobs which means that the user token or service token used need to have Read and Write access to jobs
Running with --dry-run/d will output what changes would have been triggered without triggering them
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dbt_autofix-0.4.1.tar.gz.
File metadata
- Download URL: dbt_autofix-0.4.1.tar.gz
- Upload date:
- Size: 30.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b61159810d1afc1adcfafbd6d4086e5c44cb996e692cb94ad0b75eaf7d88ed62
|
|
| MD5 |
3fc15815361c23a8c861d97e647b9578
|
|
| BLAKE2b-256 |
4cf8b917537cf5f72bbf85a553185700721ecd717aded55c0c9e14309c9d13d6
|
Provenance
The following attestation bundles were made for dbt_autofix-0.4.1.tar.gz:
Publisher:
release.yml on dbt-labs/dbt-autofix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbt_autofix-0.4.1.tar.gz -
Subject digest:
b61159810d1afc1adcfafbd6d4086e5c44cb996e692cb94ad0b75eaf7d88ed62 - Sigstore transparency entry: 241630516
- Sigstore integration time:
-
Permalink:
dbt-labs/dbt-autofix@23371537935da459478967165decb197654ff000 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/dbt-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@23371537935da459478967165decb197654ff000 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dbt_autofix-0.4.1-py3-none-any.whl.
File metadata
- Download URL: dbt_autofix-0.4.1-py3-none-any.whl
- Upload date:
- Size: 20.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5a27fb60cf5a70ebb202783196246a209643def5bbd6b0172b9fafc9b1ff13f
|
|
| MD5 |
502876173532ef179f4a1375805e62d6
|
|
| BLAKE2b-256 |
d83b98c07db463801243407e7622255dda2661c981a8dbb8a6fb1d9e345bbff8
|
Provenance
The following attestation bundles were made for dbt_autofix-0.4.1-py3-none-any.whl:
Publisher:
release.yml on dbt-labs/dbt-autofix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbt_autofix-0.4.1-py3-none-any.whl -
Subject digest:
f5a27fb60cf5a70ebb202783196246a209643def5bbd6b0172b9fafc9b1ff13f - Sigstore transparency entry: 241630527
- Sigstore integration time:
-
Permalink:
dbt-labs/dbt-autofix@23371537935da459478967165decb197654ff000 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/dbt-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@23371537935da459478967165decb197654ff000 -
Trigger Event:
push
-
Statement type: