Fortify
Catch unexpected data changes before a dbt PR is reviewed.
Documentation ·
Quickstart ·
GitHub Actions ·
Contributing ·
Issues
We like building things for the data community, and Fortify is one of them. If
it's useful to you, star the repo so more people find it. We post what we're
working on at contrastdb.com, on
X and on
LinkedIn.
Fortify validates dbt pull requests locally against Snowflake, Databricks, and
BigQuery. It builds changed models in temporary schemas, compares them with
production, and reports what needs a fix before review. Written in Rust.
Highlights
- Validate before review. Build changed models and critical downstream paths
in temporary schemas, then clean them up.
- Compare with production. Run dbt tests and compare schema, row counts,
null rates, cardinality, ranges, and primary keys.
- See downstream impact. Show affected models and columns.
- Connect directly. Use your warehouse credentials, with no Contrast account
or data sent to Contrast.
- Check and fix with your agent. Use the
verify
skill to run the check-and-fix loop.
fortify auth login uses Snowflake OAuth. Databricks uses a token supplied through the configured environment variable. BigQuery uses Google Application Default Credentials. The warehouse identity needs production read access and permission to create and remove temporary schemas or datasets.
Upgrading from Embrasure
Fortify is the new name for Embrasure CLI. The embrasure command,
embrasure-check.yml, and EMBRASURE_* environment variables remain supported
through v0.x. New projects use fortify-check.yml; --config takes precedence,
then the Fortify file, then the legacy file. FORTIFY_* variables take precedence
over their legacy equivalents. Existing credentials and warehouse cleanup markers
stay in place.
Update GitHub workflows to uses: contrastdata/fortify@v1. GitHub does not
redirect Actions after a repository rename. Existing pinned CLI versions remain
available. If an older standalone updater only installs embrasure, rerun the
installer below to add fortify.
For Homebrew, run brew update && brew upgrade embrasureai/tap/embrasure to
migrate the installed formula. Scoop users can keep updating embrasure; to
switch package names, uninstall embrasure before installing fortify. Do the
same for WinGet package IDs to avoid competing command aliases.
Snowflake quickstart
From your existing Snowflake dbt Core project directory, create or activate its Python environment:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install "dbt-core>=1.5,<2" "dbt-snowflake>=1.5,<2" "sqlglot>=30,<31"
Then install Fortify on macOS or Linux with Homebrew:
brew install contrastdata/tap/fortify
fortify init
fortify auth login
fortify doctor
fortify check --dry-run
fortify check
By default, check compares your branch with origin/main.
If dbt is managed by your project
Fortify uses the dbt Core and Snowflake adapter versions already installed by your project. Activate the project's normal environment, or set dbt.command in fortify-check.yml to the wrapper your project uses.
Databricks
Install the Databricks dbt adapter instead of dbt-snowflake:
python -m pip install "dbt-core>=1.5,<2" "dbt-databricks>=1.5,<2" "sqlglot>=30,<31"
Use a version 2 configuration with a typed provider block:
version: 2
dbt:
project_dir: .
profile: analytics
accounts:
- name: primary
provider:
type: databricks
host: https://your-workspace.cloud.databricks.com
http_path: /sql/1.0/warehouses/your-warehouse-id
catalog: analytics
production_schema: prod
auth:
type: token
token_env: DATABRICKS_TOKEN
The integration uses a Databricks SQL warehouse and Unity Catalog. Set DATABRICKS_TOKEN, then run fortify doctor and fortify check. Incremental baselines currently require managed Delta tables and use Unity Catalog shallow clones; doctor verifies that a suitable table and grants are available.
BigQuery
Install the BigQuery dbt adapter:
python -m pip install "dbt-core>=1.5,<2" "dbt-bigquery>=1.5,<2" "sqlglot>=30,<31"
For local development, create Google Application Default Credentials, then initialize Fortify from the dbt project root:
gcloud auth application-default login
fortify init
fortify doctor
fortify check --dry-run
fortify check
init detects an active BigQuery dbt profile and writes the version 2 provider configuration. The equivalent manual configuration is:
version: 2
dbt:
project_dir: .
profile: analytics
accounts:
- name: primary
provider:
type: bigquery
project: analytics-prod
location: US
production_schema: prod
maximum_bytes_billed: 10737418240
auth:
type: application_default
Application Default Credentials also support GOOGLE_APPLICATION_CREDENTIALS and an attached Google Cloud service account. maximum_bytes_billed applies the same per-query cap to dbt builds and Fortify comparison queries. Incremental baselines use BigQuery table clones; clone mode seeds candidates with table copies. The source and temporary datasets must be in the same location, and table-clone restrictions still apply.
Installation options
If you do not use Homebrew, use the installer on macOS or Linux:
curl -fsSL https://raw.githubusercontent.com/contrastdata/fortify/main/install.sh | sh
The installer writes to /usr/local/bin when writable, otherwise ~/.local/bin. Set FORTIFY_INSTALL_DIR to choose another directory.
Installing on Windows (Windows 11 or Windows Server 2022+)
Download the PowerShell installer from GitHub Releases, inspect it, then run it:
$installer = Join-Path $env:TEMP 'fortify-install.ps1'
Invoke-WebRequest https://github.com/contrastdata/fortify/releases/latest/download/install.ps1 -OutFile $installer
Get-Content $installer
Unblock-File $installer
& $installer
The installer verifies the release checksum, installs Fortify under %LOCALAPPDATA%\Programs\Fortify, and adds its bin directory to your user PATH. It does not need administrator access. Open a new terminal when it finishes.
Unblock-File removes the internet-zone marker after you inspect the script. It does not change PowerShell's execution policy or verify the publisher. If your organization blocks the script, use the portable ZIP from the same release.
Installer options:
- Pin a release:
& $installer -Version 0.6.0
- Run without prompts:
& $installer -Quiet
- Uninstall:
& $installer -Uninstall
Uninstalling removes Fortify and its PATH entry, but keeps your configuration, credentials, reports, and logs.
Scoop users can install from Fortify's official bucket:
scoop bucket add fortify https://github.com/contrastdata/scoop-bucket
scoop install fortify/fortify
WinGet manifests are generated with each release. After the first WinGet listing is accepted:
winget install --id EmbrasureAI.Fortify --exact
Use Fortify from an existing Snowflake, Databricks, or BigQuery dbt project whose unchanged production models are already materialized. Fortify uses those existing relations as the comparison baseline.
For Snowflake and BigQuery, init reads the active dbt profile and asks only for missing values. Databricks uses the version 2 configuration shown above. Use --config <path> before or after any subcommand to choose another config file.
Continue only when fortify doctor reports READY. Fortify generates a temporary dbt profile for its own runs; it does not modify your existing profile or production models.
If dbt is installed in .venv, run source .venv/bin/activate in each new shell before using Fortify.
Example result
✓ Safe to continue
The change passed across every selected dbt model.
Scope
5 affected models
2 selected for validation
Evidence
2 / 2 models built · 2 compared with production
151,615,312 candidate rows evaluated
Schema, row counts, nulls, cardinality, and distributions checked
1 primary key checked
0 findings · 3 unvalidated models
Temporary warehouse schema removed
Lineage impact
fct_orders
└─ finance_daily
├─ executive_revenue
├─ regional_margin
└─ revenue_forecast_input
Completed in 2m11s
In an interactive terminal, check shows live progress while it runs. Redirected output, CI, and --json stay plain.
Focus and preview
The default validates changed models and every path to a critical model. Critical targets are tagged critical, configured with critical: true, or used directly by a dbt exposure. Use --downstream all for every downstream model or --downstream none for changed models only. Impact is always computed from the full changed set.
Intersect the changed set with one or more explicit models:
fortify check --select orders --select order_items
fortify check --select orders --downstream none
An unknown, ambiguous, unchanged, or out-of-scope selection fails instead of returning a misleading pass.
Preview the plan without creating schemas or querying warehouse data:
fortify check --dry-run
fortify check --dry-run --json
Dry runs use local dbt parsing but do not resolve credentials, create warehouse schemas, or query warehouse data.
Reports and exit codes
JSON output is versioned and stably ordered. Progress goes to stderr, so stdout contains one JSON document.
fortify check --json
fortify check --json --markdown fortify-check.md
fortify check --json --report-version 1
Published contracts: v1, v2, v3, and v4. V4 adds column lineage and bounded warehouse execution links and is the default; older versions remain available with --report-version.
| Exit code |
Meaning |
0 |
The check passed |
1 |
The data or code needs a fix |
2 |
A requested check could not be completed |
3 |
Setup, execution, or cleanup failed |
Agent loop:
Run `fortify check --base origin/main --json`.
Exit 1: fix every finding and rerun.
Exit 2: resolve or explain every coverage gap.
Exit 3: fix the setup or execution failure.
Request review only after exit 0.
For a faster first pass on large tables, add --mode quick. Quick mode estimates cardinality and skips percentiles. Deep mode is the default. Primary-key integrity stays exact in both modes.
Arbitrary SQL checks
Query-diff checks compare any two read-only query results exactly. production_sql defaults to sql, and each dbt ref() is rendered against the candidate or production-state manifest. Checks with no refs, or definitions changed since --base, run even when no model changed.