Overview
dbt-orca is a dbt package that lets you trigger ORCA quality scans directly from your dbt workflows. Use it as a custom test on any model to enforce quality thresholds, or call it as a post-hook to scan tables after they build.
Supports dbt 1.5 through 1.x with adapter-specific implementations for Snowflake, PostgreSQL, and BigQuery.
Installation
Adddbt-orca to your packages.yml:
Environment variables
Set these before running dbt:Configuration
Add optional configuration to yourdbt_project.yml:
Using the orca_quality test
Add the test to any model in your schema.yml:
dbt test, the package will:
- Trigger an ORCA quality scan via the API
- Poll for completion (up to
orca_poll_retriesattempts) - Check the quality score against the threshold
- Pass the test if score >= threshold, fail with a clear error message if not
Standalone test file
You can also write a standalone test intests/:
Run via dbt run-operation
For ad-hoc scans without running the full test suite:
Adapter setup
The package usesadapter.dispatch to route API calls through your database’s HTTP capabilities. Out of the box, three adapters are supported.
PostgreSQL
Requires the http extension:http_post and http_get to call the ORCA API, and pg_sleep for polling intervals.
Snowflake
Requires an API integration and external function:SYSTEM$WAIT for polling intervals.
BigQuery
Create a BigQuery remote function or Cloud Function that proxies HTTP requests, then override the macro in your project:Default adapter (no native HTTP)
If your adapter does not support HTTP calls natively, the default implementation logs the equivalentcurl command so you can execute the scan manually or integrate through other means:
Post-hook auto-scanning
Trigger an ORCA scan automatically after a model builds by adding a post-hook:schema.yml:
Macros reference
| Macro | Purpose |
|---|---|
orca.test_orca_quality | Custom dbt test — triggers scan, polls, and validates score |
orca.orca_quality_scan | Convenience macro for run-operation or post-hook usage |
orca.orca_scan | Low-level macro — triggers scan and returns job_id |
orca.orca_check | Low-level macro — polls scan status and validates score |
Error handling
The package raisesCompilationError with descriptive messages when:
ORCA_API_URLorORCA_API_KEYis not set- The scan fails (API error or processing failure)
- The quality score is below the configured threshold
- Polling exhausts all retries without completion