Configure and enforce conventions for your dbt project.
Project description
dbt-bouncer
Configure and enforce conventions for your dbt project.
How to use
- Generate a
manifest.json
by runningdbt parse
. - Create a
dbt-bouncer.yml
config file, details here. - Run
dbt-bouncer
to validate that your conventions are being maintained. You can use GitHub Actions, Docker, a.pex
file or python to rundbt-bouncer
.
GitHub Actions
steps:
...
- uses: godatadriven/dbt-bouncer@v0
with:
config-file: ./<PATH_TO_CONFIG_FILE>
send-pr-comment: true # optional, defaults to true
...
Docker
Don't use GitHub Actions? You can still use dbt-bouncer via Docker:
docker run --rm \
--volume "$PWD":/app \
ghcr.io/godatadriven/dbt-bouncer:vX.X.X \
--config-file /app/<PATH_TO_CONFIG_FILE>
Pex
You can also run the .pex
(Python EXecutable) artifact directly once you have a python executable installed:
wget https://github.com/godatadriven/dbt-bouncer/releases/download/vX.X.X/dbt-bouncer.pex -O dbt-bouncer.pex
dbt-bouncer.pex --config-file $PWD/<PATH_TO_CONFIG_FILE>
Python
Install from pypi.org:
pip install dbt-bouncer
Run:
dbt-bouncer.pex --config-file $PWD/<PATH_TO_CONFIG_FILE>
Config file
dbt-bouncer
requires a config file to be provided. This file configures what checks are run. Here is an example config file:
dbt_artifacts_dir: target # [Optional] Directory where the dbt artifacts exists, generally the `target` directory inside a dbt project. Defaults to `./target`.
manifest_checks:
- name: check_macro_name_matches_file_name
- name: check_model_names
include: ^staging
model_name_pattern: ^stg_
Checks
:bulb: Click on a check name to see more details.
Macros
check_macro_arguments_description_populated
: Macro arguments must have a populated description.check_macro_description_populated
: Macros must have a populated description.check_macro_name_matches_file_name
: Macros names must be the same as the file they are contained in.
Metadata
check_project_name
: Enforce that the name of the dbt project matches a supplied regex.
Miscellaneous
check_top_level_directories
: Only specified top-level directories are allowed to contain models.
Models
check_model_description_populated
: Models must have a populated description.check_model_names
: Models must have a name that matches the supplied regex.
Sources
check_source_has_meta_keys
: Themeta
config for sources must have the specified keys.
Development
To setup your development environment, fork this repository and run:
poetry shell
poetry install
pre-commit install
Set required environment variables by copying .env.example
to .env
and updating the values.
All tests can be run via:
make build-artifacts # Rebuilds dbt artifacts used by pytest
make test
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
Hashes for dbt_bouncer-0.16.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b72cffaff89d7c48d23c7fba00dc23a544d8595bd4548d188a09697a300ffa8a |
|
MD5 | 3cf5536c90be4a02f370d04750a64132 |
|
BLAKE2b-256 | 2e997e2f61eb71532232ebac22c36f8a2f18ab9897556ac3077895ad2e812fb3 |