DuckDB SQL Data Transformation
Write ordered DuckDB SQL steps to join, cast, and reshape tables inside your pipeline.
Run multi-step DuckDB SQL over staged sources and sibling tables. Handle joins, window metrics, regex parsing, JSON extraction, and explicit UTC type casting.
What DuckDB SQL Data Transformation does
DuckDB SQL is the analytical backbone of every Mostly Right dataset, turning raw decoded inputs into clean, normalized tables. Authors write readable ordered SQL steps that cast timestamps to UTC, unnest nested arrays, join lookup tables, compute rolling windows, and deduplicate by primary key.
Every SQL step runs inside an isolated pipeline sandbox before quality checks evaluate the output table. Promoted results serve via hosted REST APIs, Parquet, CSV, and JSON downloads, plus MCP.
Input & output example
Ordered SQL steps run reproducibly on every pipeline refresh.
Staged raw sources
SELECT station_id, date_trunc('day', ts AT TIME ZONE 'UTC') AS day,
round(avg(temp_c), 2) AS avg_temp_c FROM raw_obs GROUP BY 1, 2Joined & windowed table
| station_id | day | avg_temp_c |
|---|---|---|
| KNYC | 2026-10-12 | 16.40 |
How it works
- 1
Reference staged sources as SQL relations
Each declared source in the recipe appears by name as a queryable table inside your ordered DuckDB SQL steps.
- 2
Join, cast, and deduplicate with SQL
Apply explicit CASTs, QUALIFY row_number() deduplication, window functions, and stable ORDER BY sorting.
- 3
Produce typed Parquet and gate promotion
Output strongly typed Parquet tables verified by SQL quality assertions before serving via REST API and MCP.
Try with an agent
Pre-loads DuckDB SQL in chatAggregate hourly sensors to daily rollups
Combine hourly weather and air-quality feeds in DuckDB SQL, align timestamps to UTC, and compute daily min/max/avg.
Common use cases
- Joining multiple APIs or files into one grain
- Window functions, rolling averages, and deduplication
- Regex and JSON extraction before model enrichment
Details
- Category
- Transform & Delivery
- Identifier
- duckdb-sql
- Inputs
- Staged recipe sources · Sibling tables
- Outputs
- Materialized Parquet table
- Dataset delivery
- Parquet · CSV · JSON · SQL · REST API · MCP
Frequently asked questions
Can DuckDB SQL join across multiple sources in one dataset?
Yes. Every declared source in the recipe is exposed as a relation inside DuckDB SQL steps.
Can DuckDB SQL parse JSON strings or run regex extraction?
Yes. Full DuckDB SQL functions, including json_extract, regexp_extract, strptime, and window analytics, are supported.
Does DuckDB SQL enforce stable row ordering?
Yes. Recipes specify explicit ORDER BY keys so snapshots, diffs, and pagination remain stable across refreshes.