Skip to content

Getting Started with the Playground

The playground creates a sample project that runs on DuckDB with no warehouse credentials or external services. It is the quickest way to try the compiler, type system, lineage engine and AI features.

Terminal window
rocky playground my-project

This creates a directory with everything you need:

my-project/
├── rocky.toml # DuckDB pipeline config
├── models/
│ ├── raw_orders.sql # SQL replication model
│ ├── raw_orders.toml # Model config
│ ├── customer_orders.rocky # Rocky DSL transformation
│ ├── customer_orders.toml # Model config
│ ├── revenue_summary.sql # SQL transformation
│ └── revenue_summary.toml # Model config
├── contracts/
│ └── revenue_summary.contract.toml # Data contract
└── data/
└── seed.sql # DuckDB seed data

quickstart is the only template. rocky playground loads its seed into playground.duckdb, so rocky run builds every model on the first try. The names --template ecommerce and --template showcase and their aliases fail with a message that lists the remaining templates (issue #1983). Then cd my-project.

A local DuckDB adapter, no credentials:

[adapter]
type = "duckdb"
path = "playground.duckdb"
[pipeline.playground]
type = "transformation"
models = "models/**"
# Models land in the database's default schema (`playground.main`), so a model
# can reference an upstream by name (`from raw_orders`) and it resolves both
# when materialized by `rocky run` and in the in-memory `rocky test` run.
[pipeline.playground.target.governance]
auto_create_schemas = true
[pipeline.playground.execution]
concurrency = 4

The unnamed [adapter] block auto-wraps as the default adapter, and models = "models/**" builds the DAG from models/. rocky test ignores path: it runs models in an in-memory database and loads data/seed.sql on the fly. rocky run materializes into playground.duckdb, already seeded. Re-seed with duckdb playground.duckdb < data/seed.sql.

The first model selects raw order data from the seeded source table:

raw_orders.sql:

SELECT
order_id,
customer_id,
product_id,
amount,
status,
order_date
FROM raw__orders.orders

The data/seed.sql file creates the raw__orders.orders table this model reads from.

raw_orders.toml:

[strategy]
type = "full_refresh"
[target]
catalog = "playground"
schema = "main"

The Rocky DSL is a compact syntax for common aggregations. Two playground models are SQL and this one is DSL.

-- Customer orders aggregation (Rocky DSL)
from raw_orders
where status != "cancelled"
group customer_id {
total_revenue: sum(amount),
order_count: count(),
first_order: min(order_date)
}
where total_revenue > 0

The DSL compiles to standard SQL. The compiler type-checks columns, validates aggregation semantics and resolves the raw_orders dependency.

A standard SQL transformation that builds on customer_orders:

SELECT
customer_id,
total_revenue,
order_count,
total_revenue / order_count AS avg_order_value,
first_order
FROM customer_orders
WHERE order_count >= 2

A data contract that enforces the output schema of revenue_summary:

# Loose contract suitable for the playground.
# Type checker can't infer non-null from `SELECT col FROM raw__orders.orders`
# (the source schema is unknown to the compiler), so columns are declared
# nullable here to keep `rocky compile --contracts contracts` clean.
[[columns]]
name = "customer_id"
type = "Int64"
nullable = true
[[columns]]
name = "total_revenue"
type = "Decimal"
nullable = true
[[columns]]
name = "order_count"
type = "Int64"
nullable = true
[rules]
required = ["customer_id", "total_revenue", "order_count"]
protected = ["customer_id"]
  • required: these columns must exist. The compiler checks a declared type only when it can infer the output type.
  • protected: a later change cannot remove these columns. The compiler fails with E013 if one disappears.

A strict-contract walkthrough that pins types and nullability lives in the dedicated POCs.

Run the compiler to type-check all models, resolve dependencies, and validate contracts. Pass --contracts contracts to check the model output against the contract files. Plain rocky compile skips contract validation.

Terminal window
rocky compile --contracts contracts

The command exits 0, but this template reports I003 information notices: the compiler cannot infer every type from raw__orders.orders, so it checks a declared type only when it can infer it. It still checks the required output-column names. It also builds the DAG (customer_orders depends on raw_orders, revenue_summary on customer_orders).

This pipeline does not support rocky plan. Use rocky emit-sql to inspect the statements before you run them.

Edit revenue_summary.sql and drop a required column. Remove the order_count line from the SELECT:

SELECT
customer_id,
total_revenue,
total_revenue / order_count AS avg_order_value,
first_order
FROM customer_orders
WHERE order_count >= 2

Run rocky compile --contracts contracts again:

✓ raw_orders (6 columns)
✓ customer_orders (4 columns)
✗ revenue_summary
x error[E010]: required column 'order_count' missing from model output
help: add `order_count` to the SELECT, or remove it from `[rules] required`
Compiled: 3 models, 1 errors, 0 warnings

Restore the line, then use compile as a gate: rocky compile --contracts contracts && rocky run. The two commands read the project separately, so an edit between them can change what runs. For a selected full_refresh model, rocky run --pipeline <NAME> --model <NAME> --contracts contracts checks the contract in the run’s own compile. A failed compile leaves tables from a previous run in playground.duckdb, and rocky preview rows shows those stored rows.

Rocky executes models locally on DuckDB, with no warehouse connection:

Terminal window
rocky test

Expected output:

Testing 3 models...
All 3 models passed
Result: 3 passed, 0 failed

rocky test compiles all models, runs each model’s SQL on DuckDB in dependency order, validates contracts when you pass --contracts contracts, and reports pass or fail per model.

Terminal window
rocky test --model revenue_summary
Terminal window
rocky compile --contracts contracts && rocky run
rocky preview rows --model revenue_summary # output columns and up to 100 rows

Rocky traces data flow at the column level. See the full lineage for a model:

Terminal window
rocky lineage revenue_summary
Model: revenue_summary
Upstream: customer_orders
Downstream:
Columns:
customer_id <- customer_orders.customer_id (direct)
total_revenue <- customer_orders.total_revenue (direct)
order_count <- customer_orders.order_count (direct)
avg_order_value (no lineage)
first_order <- customer_orders.first_order (direct)

avg_order_value shows (no lineage) because it is a computed expression, total_revenue / order_count. The column tracer follows only columns that pass through directly or through an aggregation.

Trace a single column through the entire chain

Section titled “Trace a single column through the entire chain”
Terminal window
rocky lineage revenue_summary --column total_revenue
Column trace: revenue_summary.total_revenue
<- customer_orders.total_revenue (direct)
<- raw_orders.amount (aggregation: sum)
<- raw__orders.orders.amount (direct)

rocky lineage revenue_summary --format dot | dot -Tsvg -o lineage.svg renders Graphviz output.

With an ANTHROPIC_API_KEY set, rocky ai "<intent>" generates and compiles a model, rocky ai-explain --all --save writes an intent field per model, and rocky ai-test --all --save generates tests. Compilation does not prove warehouse behavior or business correctness, so review the output. See the AI Features guide.

rocky ci --contracts contracts runs compilation and local tests in one pass. Exit 0 means the supported checks passed. It does not prove warehouse execution or business correctness. See CI/CD.

The playground ships 109 self-contained POCs across 8 categories. Browse them in the Examples & POC catalog, or run one:

Terminal window
cd examples/playground
./pocs/02-performance/01-incremental-watermark/run.sh

Most run on local DuckDB with no credentials. The exceptions: AI (ANTHROPIC_API_KEY), Governance (a Databricks workspace), and the warehouse-specific adapter POCs. For compile-time and memory numbers, run make bench-rocky in examples/playground/benchmarks. See Benchmarks.