Skip to content
DuckDB community extension

duckorch

Asset-centric data orchestration with JSON ingestion, partitions, declarative automation sensor, Snowflake-compatible CREATE DYNAMIC ASSET, MCP server, lineage and OpenLineage emission — all on DuckDB

01 / SETUP

Install and load

Run these commands in a Haybarn SQL session. The extension is available from the community repository.

Haybarn 2.0.0 · SQL
INSTALL duckorch FROM community;
LOAD duckorch FROM community;

Try it in a temporary SQL session with duckorch already loaded. Queries run in this tab; examples using files or services need their own setup.

Using upstream DuckDB? Follow the maintainer’s installation instructions.

02 / QUERY

Usage example

1. Set up state schema and register a directory of *.sql task files.

SQL
-- 1. Set up state schema and register a directory of *.sql task files.
PRAGMA orch_init;
PRAGMA orch_register('./tasks/');

-- 2. Run the DAG (topological order, per-layer parallelism).
SET orch_max_parallel = 4;
PRAGMA orch_run;

-- 3. Asset-aware features (Phase 13+):
PRAGMA orch_asset_list;                            -- all registered Assets
PRAGMA orch_asset_partitions('analytics.daily');   -- per-partition status
PRAGMA orch_backfill('analytics.daily', '2026-01-01', '2026-12-31');

-- 4. Snowflake-compatible declaration (Phase 17):
PRAGMA orch_create_dynamic_asset(
  'analytics.region_total',
  '5 minutes',
  'SELECT region, SUM(total) AS rt FROM analytics.daily GROUP BY region');

-- 5. Sensor — auto-materializes when upstream updates (Phase 15):
PRAGMA orch_sensor_set_interval(30);
PRAGMA orch_sensor_start;

-- 6. Mermaid lineage:
PRAGMA orch_visualize('lineage');

-- 7. JSON ingestion (Phase 19): nested JSON becomes flat parent/child
--    tables, and later-arriving columns are absorbed automatically.
PRAGMA orch_ingest_preview('orders.jsonl', 'raw.orders');   -- shape only
PRAGMA orch_ingest_run('orders/*.jsonl', 'raw.orders');
PRAGMA orch_ingest_run('orders.jsonl', 'raw.orders',
                       disposition = 'merge', primary_key = 'id');
PRAGMA orch_ingest_http('https://api.example.com/orders', 'raw.orders',
                        secret = 'orders_api', paginate = 'cursor',
                        records_path = 'data', cursor_path = 'meta.next',
                        cursor_param = 'cursor');

Provided by nkwork9999. Not yet verified on Haybarn 2.0.0.

Sample data & setup

About this extension

duckorch is a DuckDB-native, single-file Asset orchestrator that brings Dagster's declarative automation and Snowflake's CREATE DYNAMIC TABLE semantics into a LOAD duckorch;. Designed to run on a laptop or in a plane without a cloud control plane.

Inputs auto-extracted via sqlparser-rs. $partition_key bound via DuckDB PREPARE (multi-statement aware).

Project overview from the community descriptor.

Documentation and resources

Project and build details
Repository
nkwork9999/duck-orch
License
MIT
Maintainers
nkwork9999
Written in
C++
Build source
ee9ccd7966f0
Build definition
Community descriptor