Skip to main content

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

Add dbt-orca to your packages.yml:
Then install:

Environment variables

Set these before running dbt:

Configuration

Add optional configuration to your dbt_project.yml:

Using the orca_quality test

Add the test to any model in your schema.yml:
When you run dbt test, the package will:
  1. Trigger an ORCA quality scan via the API
  2. Poll for completion (up to orca_poll_retries attempts)
  3. Check the quality score against the threshold
  4. Pass the test if score >= threshold, fail with a clear error message if not

Standalone test file

You can also write a standalone test in tests/:

Run via dbt run-operation

For ad-hoc scans without running the full test suite:

Adapter setup

The package uses adapter.dispatch to route API calls through your database’s HTTP capabilities. Out of the box, three adapters are supported.

PostgreSQL

Requires the http extension:
The PostgreSQL adapter uses http_post and http_get to call the ORCA API, and pg_sleep for polling intervals.

Snowflake

Requires an API integration and external function:
The Snowflake adapter uses 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 equivalent curl 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:
Or on a specific model in schema.yml:

Macros reference

Error handling

The package raises CompilationError with descriptive messages when:
  • ORCA_API_URL or ORCA_API_KEY is not set
  • The scan fails (API error or processing failure)
  • The quality score is below the configured threshold
  • Polling exhausts all retries without completion
Example failure output: