Skip to main content

rocky-sdk

A typed Python client for the Rocky SQL transformation engine.

rocky-sdk drives the rocky command-line binary for you. A RockyClient method builds the argv, runs the binary with --output json, and parses the output. Almost every method returns a Pydantic model. A failure raises a RockyError subclass carrying structured fields, such as the exit code, the stderr tail, and the version strings.

  your code             rocky-sdk            rocky binary        your warehouse
 ┌──────────┐          ┌────────────┐       ┌───────────┐        ┌───────────┐
 │ notebook │   call   │            │ argv  │ rocky run │  SQL   │           │
 │  script  ├─────────►│ RockyClient├──────►│  --output ├───────►│  tables   │
 │   task   │◄─────────┤            │◄──────┤    json   │◄───────┤           │
 └──────────┘ Pydantic └────────────┘ JSON  └─────┬─────┘  rows  └───────────┘
               model         ▲                    │
                             └────────────────────┘
                          one stderr line per progress event.
                          RockyClient passes each line to your
                          `log_callback`, or to its own logger at INFO.

The SDK is for human Python callers: notebooks, scripts, and orchestrators. For AI agents, use rocky mcp. For an HTTP surface that any language can call, use rocky serve. The dagster-rocky integration is a thin Dagster adapter over this same client.

Install

pip install rocky-sdk

The rocky binary is not bundled. Install it separately and put it on $PATH, or pass binary_path= to the client. See the releases page. The SDK requires engine v1.34.0 or newer and checks the version on first use.

Usage

from rocky_sdk import RockyClient

client = RockyClient(config_path="rocky.toml")

# Each call below returns a typed Pydantic model.
# `compile` and `lineage` read the project. They write nothing.
compiled = client.compile()
print(compiled.models, "models,", "errors" if compiled.has_errors else "clean")
for diag in compiled.diagnostics:
    print(diag.severity, diag.code, diag.message)

lineage = client.lineage("customer_orders", column="email")
print(lineage.model, lineage.column, len(lineage.trace), "hops")

# `catalog` writes to disk. It puts `catalog.json`, `edges.parquet` and
# `assets.parquet` in `./.rocky/catalog/`. `out=` moves that directory.
# The method has no option that stops the write.
catalog = client.catalog()
print(catalog.project_name, len(catalog.assets), "assets")

# Run a pipeline. `filter` is required. `log_callback` gets each stderr line.
result = client.run("tenant=acme", log_callback=print)
print(result.status, result.tables_copied, "tables copied")
print(len(result.materializations), "models materialized")

# A partial failure returns a result, it does not raise. Read `errors` to see
# what did not build. `asset_key` is a list of path segments, not a string.
for failure in result.errors:
    print("failed:", ".".join(failure.asset_key), failure.error)

Errors

Every failure is a RockyError subclass. Import them from rocky_sdk.exceptions.

from rocky_sdk import RockyClient
from rocky_sdk.exceptions import RockyCommandError, RockyTimeoutError

client = RockyClient(config_path="rocky.toml", timeout_seconds=600)
try:
    client.run("tenant=acme")
except RockyTimeoutError as exc:
    print("timed out after", exc.timeout_seconds, "s")
    print(exc.stderr_tail)
except RockyCommandError as exc:
    print("exit", exc.returncode)
    print(exc.stderr_tail)

timeout_seconds is a wall-clock budget for one CLI call. It defaults to 3600. A watchdog thread kills the command when the budget runs out. On POSIX it kills the whole process group, so any child the binary spawned dies too. On Windows it kills the one process.

Exception Raised when
RockyBinaryNotFoundError the rocky binary is missing, or the path is there but will not execute
RockyVersionError the binary is older than the SDK's minimum
RockyTimeoutError the watchdog killed the command
RockyCommandError the command exited non-zero
RockyPartialFailure the command exited non-zero but printed usable JSON. run, compile, test and the other partial-tolerant methods return that result instead of raising. To get the raise, call run_cli yourself: its allow_partial defaults to False. Subclasses RockyCommandError
RockyOutputParseError stdout was not the JSON shape the SDK expected
RockyServerError a rocky serve HTTP request failed
RockyGovernanceError a governance_override is malformed, or its empty workspace_ids would revoke every workspace binding on the target catalog

Example script

A runnable end-to-end script lives in the repository at sdk/python/examples/quickstart.py. The wheel does not ship it, so download that file first. Then, with the rocky binary on your PATH:

python quickstart.py

It creates a throwaway DuckDB playground that needs no credentials. It then walks through compile, DAG, lineage, a real run, and typed error handling.

Documentation

License

Apache-2.0

Release files for rocky-sdk 0.14.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rocky-sdk 0.14.0
File Size Uploaded
rocky_sdk-0.14.0.tar.gz 273.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rocky-sdk 0.14.0
File Interpreter ABI Platform
rocky_sdk-0.14.0-py3-none-any.whl Python 3 none any Details

Total release size: 542.1 kB

Release files / rocky_sdk-0.14.0.tar.gz

Download URL rocky_sdk-0.14.0.tar.gz
Size 273.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6714c189e26f79e41bc03f78d6b8161cde25b1690c4f29052970ad6d0096c15d
BLAKE2b-256 checksum
How to use checksums
e8ebb96f8e9dca2f030950b77cd557b839bc9bf904cffb1ab0925a704f5c58e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.

Transparency log

Release files / rocky_sdk-0.14.0-py3-none-any.whl

Download URL rocky_sdk-0.14.0-py3-none-any.whl
Size 269.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66b8429c4bff72b0ee66ba5517d6dc45a598a7c78348232149dc63373de9a9b9
BLAKE2b-256 checksum
How to use checksums
630121e2ac65ca5e7b39009da74e9d9f18cf43f94f5fec9deed808af59936084
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.

Transparency log

Release history Release notifications | RSS feed

0.15.0

2 release files

This release

0.14.0 This release

2 release files

0.13.0

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page