Skip to content

Architecture

Rocky’s engine is a single Cargo workspace. It holds 32 crates under engine/crates/, plus two binary crates. Each crate does one job.

This page is the map of those crates. Execution Flow traces a run step by step.

An adapter is the plug between the engine and one outside system. Rocky has two kinds.

Source adapters do discovery: they find which schemas and tables exist. They do not extract data. An ingestion tool (Fivetran, Airbyte) or a manual load must land the data in the warehouse first.

Crate Discovers from
rocky-fivetran The Fivetran REST API: connectors and their enabled tables
rocky-airbyte The Airbyte API
rocky-iceberg An Iceberg REST catalog
rocky-duckdb information_schema of a local DuckDB database
Manual source (in rocky-core) rocky.toml

The Fivetran and Airbyte adapters can wait for a running sync, and can start one when both opt-ins are set (allow_sync_trigger on the adapter, trigger = true on the pipeline). Rocky still moves no data.

Warehouse adapters do execution: they run SQL, manage the catalog lifecycle, and apply governance (tags, permissions, workspace isolation).

Crate Warehouse
rocky-databricks Databricks SQL Statement API, Unity Catalog, adaptive concurrency
rocky-snowflake Snowflake REST API
rocky-bigquery BigQuery REST API (Beta)
rocky-trino Trino /v1/statement (Beta)
rocky-postgres PostgreSQL and Redshift (Beta), wire protocol
rocky-sqlserver SQL Server over TDS. Azure SQL and Fabric Warehouse are Beta
rocky-clickhouse ClickHouse HTTP interface (Beta)
rocky-spark Apache Spark over Spark Connect (Beta)
rocky-duckdb Local in-process execution for development, testing and CI

Auth, strategies and limits for each warehouse: Adapters.

rocky-ir holds the typed Intermediate Representation (IR): ModelIr, MaterializationStrategy, and the source and target descriptors. It is a separate crate so an adapter can depend on the IR without the SQL-generation code.

rocky-core holds the warehouse-agnostic logic. It depends on rocky-ir and knows nothing about any named warehouse or source. So a new warehouse or source needs a new adapter crate, and the core engine does not change.

engine/ (Rust CLI and engine, this section), sdk/python/ (rocky-sdk, a typed Python client over the CLI), integrations/dagster/ (dagster-rocky, a thin adapter over rocky-sdk), editors/vscode/ (LSP client), examples/playground/ (POC catalog and benchmarks) and docs/ (Astro + Starlight). The playground catalog ships 109 POCs across 8 categories: see the playground guide.

The crates are the adapters above plus the crates below, the two binary crates (rocky/, the CLI, and rocky-lsp/, the rocky lsp language server) and ui/ (the React browser UI that rocky serve --ui embeds).

Crate Job
rocky-ir, rocky-core, rocky-sql, rocky-lang, rocky-compiler Typed IR, generic engine, SQL parsing, DSL parser, type checking (detailed below)
rocky-adapter-sdk Adapter SDK and conformance tests
rocky-catalog-core Catalog client abstraction (Iceberg REST, Unity Catalog, Polaris, Nessie)
rocky-secret-registry Prints resolved ${VAR} values as ${NAME}
rocky-core-compiletest, rocky-cli-compiletest Compile-fail (trybuild) guards: for rocky-core, and that rocky-cli’s plan writers stay crate-private
rocky-engine, rocky-server, rocky-cache, rocky-ai, rocky-observe, rocky-cli Described below
rocky-fulfill Fulfillment loop behind rocky fulfill (experimental)
rocky-mcp MCP server backing rocky mcp
rocky-verify Standalone offline verifier for rocky-manifest attestations
rocky-wasm WebAssembly exports for browser and edge

The typed IR. It carries data only: no traits, no logic. It holds ModelIr, the MaterializationStrategy enum (below), the source and target descriptors, and partition windows.

The warehouse-agnostic engine. It reads IR and writes SQL for one dialect.

Module Job
schema.rs Schema pattern parsing (src__acme__us_west__shopify into components)
drift.rs Schema drift detection
sql_gen.rs IR to dialect-specific SQL
state.rs Embedded redb state store: watermarks, run history
state_sync.rs Remote state: S3, GCS, Valkey, or tiered (Valkey + S3)
catalog.rs Catalog and schema lifecycle (CREATE IF NOT EXISTS, tagging)
checks.rs, contracts.rs Inline data quality checks, data contracts
unified_dag.rs, dag_executor.rs Layered execution across pipeline stages (the topological sort is in rocky-ir::dag)
models.rs Model loading (sidecar .sql + .toml)
source.rs Source adapter traits, manual source
config.rs TOML parsing with ${VAR} and ${VAR:-default} substitution

SQL parsing and validation on sqlparser-rs. It reads SQL. Each adapter’s own SqlDialect writes the per-warehouse SQL.

  • parser.rs: wraps sqlparser-rs with typed extensions.
  • dialect.rs: the one dialect Rocky parses every model with, whatever the target warehouse. It follows Databricks SQL and accepts SELECT * EXCEPT (...), * EXCLUDE (...) and * REPLACE (... AS col). With [portability] target_dialect set, P001 flags * EXCLUDE and * REPLACE on a target that lacks them.
  • validation.rs: identifier validation. See SQL Safety.

Trino adapter (Beta).

  • connector.rs drives POST /v1/statement and the nextUri polling state machine. Every nextUri must match the coordinator’s scheme, host and port.
  • Auth: HTTP Basic and JWT bearer, with RedactedString credentials.
  • v0 limits: no MERGE (connector-dependent), no OAuth/Kerberos, no governance, no checksum-bisection.

cargo test -p rocky-trino --features trino-conformance -- --ignored runs against a real trinodb/trino coordinator in Docker. The default cargo test -p rocky-trino needs no credentials or network.

Crate Notes
rocky-lang .rocky DSL: token.rs (scanner, logos), parser.rs (recursive descent), lower.rs (lower_to_sql()). The model then takes the same path as hand-written SQL.
rocky-compiler typecheck.rs, semantic.rs, diagnostic.rs. See The Rocky Compiler.
rocky-adapter-sdk Stable, versioned traits WarehouseAdapter, SqlDialect, DiscoveryAdapter, GovernanceAdapter, plus 26 conformance tests (18 always-run, 8 capability-gated). See Adapter SDK.
rocky-databricks SQL Statement Execution API (POST /api/2.0/sql/statements, polling), Unity Catalog, workspace bindings, batched information_schema queries (UNION ALL, batches of 200). permissions.rs runs GRANT and parses SHOW GRANTS. REVOKE helpers exist, but rocky run does not call them. Auth tries PAT (DATABRICKS_TOKEN), then OAuth M2M (DATABRICKS_CLIENT_ID + DATABRICKS_CLIENT_SECRET).
rocky-snowflake OAuth, password and RS256 key-pair JWT auth (auto-detected), a REST client, dynamic tables and multi-statement transactions.
rocky-fivetran Metadata only: a cursor-paginated REST client (Basic Auth) lists connectors and schemas. sync.rs detects new data by timestamp comparison.
rocky-iceberg The Iceberg and Delta UniForm writer behind content_addressed: discover(), write_batch() (blake3-named Parquet plus a Delta log commit), sync_iceberg_metadata(). See Content-Addressed Materialization.
rocky-engine Local execution on DuckDB (rocky-duckdb). Powers rocky test, branching and local CI runs.
rocky-server HTTP support (axum): bearer-token auth and scope, the async job model, webhook ingress, the browser UI’s Host/Origin guard. Also the LSP (tower-lsp) for rocky lsp. The /api/v1 routes and UI files live in rocky-cli (api.rs).
rocky-cache Three tiers: in-process LRU with TTL, Valkey/Redis with distributed locks, and a tiered chain. A miss at one tier fills the tiers above it.
rocky-observe metrics.rs (counters and p50/p95/max histograms, in run output), tracing_setup.rs (JSON logging), events.rs (Valkey Pub/Sub), otel.rs (OTLP exporter with --features otel and OTEL_EXPORTER_OTLP_ENDPOINT).
rocky-ai The AI intent layer (Claude): model generation, intent extraction, schema change sync, test generation. Runs the compile-verify loop (up to 3 attempts). Needs ANTHROPIC_API_KEY.
rocky-cli CLI framework on clap: commands/ (80+ commands), output.rs (typed JSON output structs with JsonSchema for codegen), pipes.rs (Dagster Pipes emitter, active when DAGSTER_PIPES_CONTEXT is set).
rocky (binary) main.rs wires the library crates together and dispatches CLI commands.

Rocky compiles your config and SQL into one typed intermediate representation before it writes any executable SQL. Types, lineage and validation live on it, so later stages read structure, not text. It lives in rocky-ir.

Two front ends feed it, and they converge before the IR:

.rocky DSL ──► lower_to_sql() ──┐
(rocky-lang/lower.rs) │
├──► SQL string + sidecar TOML
raw .sql + .toml sidecar ───────┘ │
│ to_model_ir()
│ (rocky-core/models.rs)
▼
ModelIr
the one typed intermediate
│ sql_gen.rs
▼
dialect SQL

There is no second intermediate form. A .rocky model and a raw-SQL model both arrive at the IR as a SQL string plus its sidecar config.

ModelIr is the single in-memory plan representation.

ModelIr carries the source and target descriptors, the materialization strategy, and whatever dependencies, sources, contracts, and checks the model declares. Replication and transformation pipelines compile to the same ModelIr shape. Which descriptors are populated is what tells the two kinds apart.

The enum rocky-ir::ir::MaterializationStrategy decides how a model’s rows land in the target table, one strategy per model. SQL Generation lists each strategy and the statement it emits. SQL generation lives in rocky-core::sql_gen.