Static analysis and health report generator for dbt projects
Project description
dbt-tester
A powerful static analysis tool for dbt projects that scans models, schemas, and sources to find issues like missing tests, undocumented columns, hardcoded references, and more.
What is dbt-tester?
DBT TESTER helps you:
- Find models without tests
- Identify undocumented columns
- Catch hardcoded table references
- Verify data quality rules
- Generate reports for team review
Quick Start (5 minutes)
Step 1: Install
# Create virtual environment (recommended)
python -m venv .venv
# Activate (Linux/Mac)
source .venv/bin/activate
# Activate (Windows)
.venv\Scripts\activate
# Install
pip install -e .
Step 2: Run Your First Scan
# Scan a dbt project
dbt-tester run /path/to/your/dbt/project
# Or scan current folder
dbt-tester run .
Step 3: Understand Results
DBT TESTER v0.1.0
Version: 0.1.0 | Created by: VINOTH J
SYSTEM STATUS: X CRITICAL
Models: 354 | Sources: 0
ISSUE MATRIX:
ERROR: 100
WARN: 50
DASHBOARD:
Models Scanned: 354
Total Issues: 150
Status: CRIT
Command Options
Basic Options
| Command | What it does |
|---|---|
dbt-tester run . |
Scan current directory |
dbt-tester run /path/to/project |
Scan specific folder |
dbt-tester run . -v |
Show fix instructions |
Output Formats
| Format | Command | Best for |
|---|---|---|
| Terminal | --format console |
Quick review |
| HTML | --format html --output report.html |
Share with team |
| JSON | --format json --output report.json |
CI/CD automation |
Exit Control
| Option | When it exits with code 1 |
|---|---|
--fail-on error |
If any ERROR found |
--fail-on warning |
If any WARNING or ERROR found |
Example for CI:
dbt-tester run . --format html --output report.html --fail-on warning
Understanding Output
Status Types
- X CRITICAL = Must fix (will break builds)
- ! WARNING = Should fix (data quality risk)
- OK HEALTHY = No issues found
Common Issues
| Issue | Meaning | How to Fix |
|---|---|---|
| ERROR: Model has no tests | Add tests in schema.yml | Add tests: - not_null |
| ERROR: Missing description | Add doc in schema.yml | Add description: "..." |
| ERROR: Hardcoded table ref | Use ref() instead | Replace db.table with {{ ref('model') }} |
| WARN: Column missing not_null | Add not_null test | Add test for *_id columns |
Installation for Distribution
If you want to share the package:
# Build
python -m build
# Upload to PyPI (need account)
twine upload dist/*
Then anyone can install:
pip install dbt-tester
dbt-tester run .
For Developers
# Run tests
pytest
# Test with sample project
dbt-tester run tests/fixtures/basic_project --format console
Troubleshooting
"No matching distribution found"
Your Python is too old. Use Python 3.9+:
python3 -m venv .venv
source .venv/bin/activate
pip install dbt-tester
"externally-managed-environment"
Use virtual environment:
python -m venv .venv
source .venv/bin/activate
pip install -e .
Examples
Basic Scan
dbt-tester run ./my_dbt_project
With HTML Report
dbt-tester run ./my_dbt_project --format html --output report.html
CI/CD Integration
# Exit 1 if any error
dbt-tester run . --fail-on error
# Create report for artifacts
dbt-tester run . --format html --output dbt-report.html --fail-on warning
License
MIT License
Project details
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_tester-0.2.0.tar.gz.
File metadata
- Download URL: dbt_tester-0.2.0.tar.gz
- Upload date:
- Size: 21.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ef3d05fc807c0dfe89a75fdc985c83ae7958bc9b919e34966daa0b5bc942523
|
|
| MD5 |
8d42bb56ed51db01eaec58947d63374e
|
|
| BLAKE2b-256 |
de275a7ea4f6145a8115625b424688a18bb92708fabacc8f74007ffc1ddd8f08
|
File details
Details for the file dbt_tester-0.2.0-py3-none-any.whl.
File metadata
- Download URL: dbt_tester-0.2.0-py3-none-any.whl
- Upload date:
- Size: 26.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4d7ed827f88f739a46db36415a25d2e440a79c5307af22dc74c8751343710de
|
|
| MD5 |
aa1fd06d6f4c69fc191ee65857bdc70b
|
|
| BLAKE2b-256 |
9cd82135534b772ba06a2a1ffaccf45611e49d85577e943e074506095880ce75
|