Run your dbt tests using Great Expectations as the execution engine
Project description
dbt-gx
Run your dbt tests powered by Great Expectations — richer assertions, structured JSON results, and auto-generated data docs, without changing a single line of your dbt project.
dbt-gx bridges dbt and Great Expectations. It reads your compiled dbt manifest, converts your existing tests into GX expectations, executes them against your warehouse, and writes machine-readable results you can feed into dashboards, alerts, or CI gates.
Why dbt-gx?
- Zero setup overhead — no separate GX project, no config files to maintain; point it at your dbt project and go
- Drop-in compatibility —
not_null,unique, and populardbt_utilstests convert automatically with no changes to your models - Structured output — JSON results per suite and per expectation, ready for downstream processing or CI failure thresholds
- Fully extensible — map any GX expectation with a one-line YAML entry, or plug in a custom Python function for logic that goes beyond simple checks
- Optional data docs — generate a browsable HTML validation report alongside your dbt docs
Installation
# Install core package (PostgreSQL support included)
pip install dbt-gx
# With Snowflake support
pip install "dbt-gx[snowflake]"
After installation, the dbt-gx command is available in your shell:
dbt-gx --help
Usage
CLI Usage
- Add configuration to your dbt project:
Create a dbt_gx_config.yml file in your dbt project root:
project_dir: .
profiles_dir: ~/.dbt
target: dev
vars: {}
- (Optional) Create a custom test conversion configuration file:
The package comes with built-in test conversions for common dbt tests. If you need to add or override test conversions, create a test_mappings.yml file:
test_mappings:
# Override a default test conversion
unique:
expectation: expect_column_values_to_be_unique
params:
column: "{column_name}"
ignore_null: true # Add additional parameter
# Add a custom test conversion
custom_test:
expectation: custom_expectation
params:
column: "{column_name}"
function: path.to.custom_function
- Run tests:
# Use only default test conversions
dbt-gx test --config dbt_gx_config.yml
# Use default test conversions and your custom ones
dbt-gx test --config dbt_gx_config.yml --test-conversion-config test_mappings.yml
Configuration
Built-in Test Conversions
The package includes default test conversions for:
-
Standard dbt tests:
uniquenot_nullaccepted_valuesrelationships
-
dbt_utils tests:
dbt_utils.at_least_onedbt_utils.equal_rowcountdbt_utils.fewer_rows_thandbt_utils.not_constant
-
dbt_expectations tests:
dbt_expectations.expect_column_values_to_be_betweendbt_expectations.expect_column_values_to_match_regexdbt_expectations.expect_column_values_to_be_in_type_list
Custom Test Conversions
You can override default test conversions or add new ones in your custom configuration file. Each test configuration can include:
expectation: The Great Expectations expectation nameparams: Parameters to pass to the expectationfunction: (Optional) Path to a custom conversion function
Custom Test Functions
You can create custom test conversion functions:
def custom_function(test_config: dict, context: dict) -> dict:
"""
Custom test conversion function.
Args:
test_config: The dbt test configuration
context: Context information including column name, table name, etc.
Returns:
dict: Great Expectations expectation configuration
"""
return {
"expectation_type": "custom_expectation",
"kwargs": {
"column": context["column_name"],
# Add custom parameters
}
}
Supported databases
| Database | Install extra |
|---|---|
| PostgreSQL | (included) |
| Snowflake | dbt-gx[snowflake] |
Development
pip install -e ".[dev]"
pre-commit install
Unit tests (no external services)
pytest tests/test_scanner.py tests/test_converter.py tests/test_config.py tests/test_runner.py
Integration tests (requires Docker)
Start the Postgres database (exposed on port 5433), compile the test dbt project, then run dbt-gx against it:
docker compose up -d
cd tests/resources/dbt_projects/jaffle-shop
dbt deps
dbt seed --profiles-dir ../../dbt_profiles --target dev
dbt run --profiles-dir ../../dbt_profiles --target dev
cd ../../../..
dbt-gx --project-dir tests/resources/dbt_projects/jaffle-shop \
test \
--profiles-dir tests/resources/dbt_profiles \
--target dev
Results are written to tests/resources/dbt_projects/jaffle-shop/target/dbt_gx/test_results.json.
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_gx-0.1.0.tar.gz.
File metadata
- Download URL: dbt_gx-0.1.0.tar.gz
- Upload date:
- Size: 51.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e2cbc33a2f12b819bf9a0bf65e18553e9eb0b6d0b4bfa28a4fdb48a5f3be13c
|
|
| MD5 |
bcccbf0a3b570b378db31ee192509281
|
|
| BLAKE2b-256 |
202d92468fc4e04393ac3fd460852f46e921c9a03baeab288daae2800da34bb8
|
Provenance
The following attestation bundles were made for dbt_gx-0.1.0.tar.gz:
Publisher:
release.yml on ms32035/dbt-gx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbt_gx-0.1.0.tar.gz -
Subject digest:
6e2cbc33a2f12b819bf9a0bf65e18553e9eb0b6d0b4bfa28a4fdb48a5f3be13c - Sigstore transparency entry: 1339331668
- Sigstore integration time:
-
Permalink:
ms32035/dbt-gx@e8d1add766bc816d7ccf4ab3d1059b576e113454 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ms32035
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e8d1add766bc816d7ccf4ab3d1059b576e113454 -
Trigger Event:
release
-
Statement type:
File details
Details for the file dbt_gx-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dbt_gx-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ffd1ee6b8fd6fded6ff62bbbdddb42cde43e0a3f580fd1ba8f30c2ead98724e
|
|
| MD5 |
b9165280dd3e0223b85d3f27d7f75045
|
|
| BLAKE2b-256 |
3ac09161036a3eef5060eed266e47c68a572841f9c165dbb1f78aa970c848196
|
Provenance
The following attestation bundles were made for dbt_gx-0.1.0-py3-none-any.whl:
Publisher:
release.yml on ms32035/dbt-gx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbt_gx-0.1.0-py3-none-any.whl -
Subject digest:
0ffd1ee6b8fd6fded6ff62bbbdddb42cde43e0a3f580fd1ba8f30c2ead98724e - Sigstore transparency entry: 1339331671
- Sigstore integration time:
-
Permalink:
ms32035/dbt-gx@e8d1add766bc816d7ccf4ab3d1059b576e113454 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ms32035
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e8d1add766bc816d7ccf4ab3d1059b576e113454 -
Trigger Event:
release
-
Statement type: