Skip to main content

dbt-gx

PyPI Python CI License: MIT

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 popular dbt_utils tests 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

  1. 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: {}
  1. (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
  1. 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:

    • unique
    • not_null
    • accepted_values
    • relationships
  • dbt_utils tests:

    • dbt_utils.at_least_one
    • dbt_utils.equal_rowcount
    • dbt_utils.fewer_rows_than
    • dbt_utils.not_constant
  • dbt_expectations tests:

    • dbt_expectations.expect_column_values_to_be_between
    • dbt_expectations.expect_column_values_to_match_regex
    • dbt_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 name
  • params: Parameters to pass to the expectation
  • function: (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.

Metadata

Release files for dbt-gx 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dbt-gx 0.1.0
File Size Uploaded Provenance Actions
dbt_gx-0.1.0.tar.gz 51.3 kB With provenance Details for dbt_gx-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dbt-gx 0.1.0
File Interpreter ABI Platform Actions
dbt_gx-0.1.0-py3-none-any.whl Python 3 none any Details for dbt_gx-0.1.0-py3-none-any.whl

Total release size: 73.0 kB

Release files / dbt_gx-0.1.0.tar.gz

Download URL dbt_gx-0.1.0.tar.gz
Size 51.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6e2cbc33a2f12b819bf9a0bf65e18553e9eb0b6d0b4bfa28a4fdb48a5f3be13c
BLAKE2b-256 checksum
How to use checksums
202d92468fc4e04393ac3fd460852f46e921c9a03baeab288daae2800da34bb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 18, 2026.

Transparency log

Release files / dbt_gx-0.1.0-py3-none-any.whl

Download URL dbt_gx-0.1.0-py3-none-any.whl
Size 21.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0ffd1ee6b8fd6fded6ff62bbbdddb42cde43e0a3f580fd1ba8f30c2ead98724e
BLAKE2b-256 checksum
How to use checksums
3ac09161036a3eef5060eed266e47c68a572841f9c165dbb1f78aa970c848196
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 18, 2026.

Transparency log

Security for dbt-gx 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dbt_gx-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page