dbtective is a Rust-powered 'detective' for dbt metadata best practices. As your dbt project grows, keeping metadata consistent and high-quality can become a real challenge.
Explore the full documentation or the possible rules.
dbtective makes it easy to spot and fix common issues, examples:
- Missing descriptions: Does every model and seed have a description?
- Column types: Are all columns explicitly typed?
- Ownership: Do all sources have an owner?
- Naming conventions: Are all marts following your team's naming standards?
We detect and enforce these rules in your cli, prek/pre-commit and CI/CD pipeline, so fast you will barely notice🕵️.
Pip (pypi)
pip install dbtectiveuv
Install as a dev dependency:
uv add dbtective --devHomebrew
brew install feliblo/tap/dbtectiveGitHub Actions
Run dbtective as part of your CI/CD pipeline. See the GitHub Actions documentation for more details.
- uses: feliblo/dbtective@v0.2.2
with:
config-file: "dbtective.yml"
entry-point: "."
only-manifest: "true"
verbose: "false"prek/pre-commit
Prerequisite: dbtective is installed via one of the methods above.
We recommend using --only-manifest and --hide-warnings with prek/pre-commit to avoid issues caused by catalog.json mismatches. Eligible catalog rules automatically fall back to manifest data. See the pre-commit documentation and Only Manifest Mode for details.
Add the following to your .pre-commit-config.yaml:
repos:
- repo: https://github.com/feliblo/dbtective
rev: v0.2.2
hooks:
- id: dbtective-run
entry: dbtective run
args: [--only-manifest, --hide-warnings]And run:
prek install
prek run --all-files
# or with pre-commit
pre-commit install
pre-commit run --all-filesShell installer (macOS/Linux)
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/feliblo/dbtective/releases/latest/download/dbtective-installer.sh | shPowerShell installer (Windows)
irm https://github.com/feliblo/dbtective/releases/latest/download/dbtective-installer.ps1 | iexBinary download
Pre-built binaries for Linux, macOS, and Windows are available on the releases page.
All possible rules can be found in the rules documentation. Information about customizing dbtective is shown at the config documentation
-
Generate your config file by answering a few simple questions:
dbtective init
This walks you through picking a config format, and which rules to enable. It then generates a config you can start with. See the CLI reference for details.
-
(Optional) Generate the dbt manifest and catalog files if you haven't done so already. Most dbt commands automatically generate the
manifest.json, but if you want to ensure both files are up to date, run:dbt compile dbt docs generate
Tip: For local development and pre-commit, use
--only-manifestto skipcatalog.json. Eligible catalog rules will fall back to manifest data automatically. -
Run
dbtectivein the root of your current directory or specify an entry point if your dbt_project is not located in the root/current drectory.dbtective run dbtective run --entry-point "my_dbt_project" -
Review the output and fix any issues found.
-
(Optional) Integrate
dbtectiveinto your CI/CD pipeline or pre-commit hooks to automate rules on every commit and/or pull request.
We welcome contributions! Whether you're fixing bugs, adding features, or improving documentation, your help makes dbtective better for everyone.
For detailed contributing guidelines, development setup, and coding standards, please see the contributing documentation.
This project is heavily inspired by dbt-bouncer. It tries to improve certain aspects of the amazing work by pgoslatara, while giving me an opportunity to improve my Rust. More about the aspects we try to improve is available in our FAQ.
