Skip to content

Introduction

dagster-rocky is a thin adapter. It calls the rocky command-line binary through rocky-sdk’s RockyClient, then turns each result into Dagster assets and asset checks.

Rocky type-checks and runs your SQL, traces column lineage, detects schema drift, and enforces compile-time contracts. Dagster schedules, retries, alerts, and draws the asset graph. dagster-rocky reports each Rocky result as a native Dagster event.

To drive Rocky from a notebook, a script, or a non-Dagster orchestrator, use the SDK directly.

There are two ways to wire Rocky into Dagster. Start with the component. It discovers your tables for you.

Option A: component (defs.yaml):

type: dagster_rocky.RockyComponent
attributes:
binary_path: rocky
config_path: config/rocky.toml
models_dir: models

Option B: resource + asset:

import dagster as dg
from dagster_rocky import RockyResource
rocky = RockyResource(binary_path="rocky", config_path="config/rocky.toml")
@dg.asset
def acme_orders(rocky: RockyResource) -> dg.MaterializeResult:
result = rocky.run(filter="tenant=acme")
return dg.MaterializeResult(
metadata={"tables_copied": result.tables_copied, "duration_ms": result.duration_ms},
)
defs = dg.Definitions(assets=[acme_orders], resources={"rocky": rocky})
Symbol Purpose
RockyResource ConfigurableResource wrapping the CLI. One method per CLI command, three run modes (buffered, streaming, Pipes)
RockyComponent State-backed component that caches discovery; dag_mode=True builds connected asset graphs
RockyDagsterTranslator Customize asset keys, groups, tags, and metadata per Rocky table
load_rocky_assets() Returns one AssetSpec per enabled Rocky table
emit_check_results() / emit_materializations() Convert Rocky results into Dagster events

Every Rocky call travels down this chain. Results travel back up it.

┌────────────────────────────────────────────────────────┐
│ Dagster asset or check │
│ your code calls rocky.run(...) on the resource │
└───────────────────────────┬────────────────────────────┘
│ Python method call
▼
┌────────────────────────────────────────────────────────┐
│ RockyResource (dagster-rocky) │
│ adds the Dagster parts: logging, Pipes, dg.Failure │
└───────────────────────────┬────────────────────────────┘
│ Python method call
▼
┌────────────────────────────────────────────────────────┐
│ RockyClient (rocky-sdk) │
│ builds the argument list, parses stdout into types │
└───────────────────────────┬────────────────────────────┘
│ subprocess:
│ rocky run --output json
▼
┌────────────────────────────────────────────────────────┐
│ rocky CLI (Rust binary) │
│ checks the project, then executes the command │
└───────────────────────────┬────────────────────────────┘
│ warehouse operations
▼
┌────────────────────────────────────────────────────────┐
│ your warehouse │
│ DuckDB, Databricks, Snowflake, BigQuery, and others │
└────────────────────────────────────────────────────────┘

The CLI prints typed JSON on stdout. RockyClient parses it into Pydantic models. RockyResource and the helpers turn the models into Dagster events.

dagster-rocky needs dagster >= 1.13.8, rocky-sdk >= 0.18.0, and the rocky binary. See Installation for the full list and for how to pin one binary version in a deployment.