dbt integration
dbt
Patrol the table behind a dbt model. DataRanger reads dbt's target/manifest.json to find the table and profiles.yml to connect (DuckDB, Snowflake and Postgres targets, and BigQuery as experimental), then queries the warehouse itself; it does not run dbt.
Keep the column mapping with the model:
models:
- name: fct_payments
meta:
dataranger:
ref_model: dim_customers
manifest_model: control_totals
key: payment_id
date: paid_on
segment: channel
amount: amount
pip install "dataranger[dbt]" # add the snowflake, postgres or bigquery extra for those targets
dbt build
dataranger patrol --dbt-model fct_payments --days 45
When meta doesn't set key, a unique test on one column of the model gives it. When it doesn't set reference, a relationships test gives the reference column, ref_model and ref_key. If a model has two such tests, DataRanger doesn't guess: it keeps the default and says which setting to add.
Flags such as --key or --dbt-ref-model override the meta block (and the tests), and --dbt-target prod picks another target. There is a complete project you can run without a warehouse in examples/dbt.
The BigQuery target is experimental: so far it has only run against a stand-in client. BigQuery bills by bytes scanned, so use --days to keep the scan small; without it a patrol reads the whole table. If the profile sets maximum_bytes_billed, every query carries that cap and BigQuery refuses a query that would scan more.
The standalone dbt package provides source reconciliation tests without Python or an agent.