Start
Quickstart
From a ragged JSONL file to a typed Parquet file and a self-contained Iceberg v2
table, then read back by an engine shapeshift did not write. Every output block on this page
was produced by shapeshift 0.4.0 from the repository's examples/.
Captured from a 0.4.0 build on a Windows host; the one Windows path separator in
the output is shown as /. Uuids and snapshot ids differ on every run.
Before you start
You need the shapeshift binary (see Install) and a
clone of the repository for its two fixtures. examples/events.jsonl is five lines:
four records that do not agree with each other, and one that is not JSON at all.
{"id": 1, "user": {"name": "Ada", "plan": "pro"}, "amount": 12.50, "event_at": "2026-07-13T09:15:00Z", "day": "2026-07-13", "tags": ["a","b"], "active": true}
{"id": 2, "user": {"name": "Grace", "plan": "free"}, "amount": 3, "event_at": "2026-07-13T10:00:00Z", "day": "2026-07-13", "tags": [], "active": false}
{"id": 3, "user": {"name": "Linus"}, "amount": 99.99, "event_at": "2026-07-12T23:59:59Z", "day": "2026-07-12", "tags": ["x"], "active": true}
not-json-a-bad-line
{"id": 4, "user": {"name": "Edsger", "plan": "pro"}, "amount": 0, "event_at": "2026-07-11T08:00:00Z", "day": "2026-07-11", "active": true}
amount is an integer in two records and a float in two; Linus has no plan;
Edsger has no tags. That is the normal state of JSON from a real producer.
1. Infer a spec
infer samples the input and prints a spec you can edit and commit. It is the
governance surface: one per source shape, reviewed like code.
$ shapeshift infer -i examples/events.jsonl dataset: events source: format: jsonl path: examples/events.jsonl output: format: parquet path: events.parquet compression: snappy schema: infer columns: - name: active type: bool required: false - name: amount type: float64 required: false - name: day type: date required: false - name: event_at type: timestamp required: false - name: id type: int64 required: false - name: tags type: json required: false - name: user.name type: string required: false - name: user.plan type: string required: false options: flatten: true row_group_rows: 50000 infer_sample: 1000
- Nested objects flatten to dotted columns:
user.name,user.plan. - Integers and floats in one field widen to
float64. YYYY-MM-DDstrings becomedate; RFC3339 strings becometimestamp.- Arrays become a
jsoncolumn: the value kept as compact JSON text.
Add -o events.yaml to write the spec to a file instead of printing it.
2. Shape it to Parquet
With no --spec, shape infers on the fly, so --input and
--output are required.
$ shapeshift shape --input examples/events.jsonl --output events.parquet shaped `events` → events.parquet (Parquet) rows_in=4 rows_out=4 rejected=0 parse_errors=1 row_groups=1 bytes=2588 malformed / rejected rows → events.parquet.rejects.jsonl (1 parse, 0 shaped-out) $ cat events.parquet.rejects.jsonl {"error":"ExpectedNull at character 0 ('n')","line":4,"raw":"not-json-a-bad-line"}
The bad line did not stop the run and was not dropped silently: it is counted, and its raw text is kept in a sidecar beside the output with its line number and the parser's error. Exit status is 0.
- is standard input, and the source is read once, so a pipe shapes exactly what
the file would:
$ cat examples/events.jsonl | shapeshift shape -i - -o piped.parquet
shaped `stdin` → piped.parquet (Parquet)
rows_in=4 rows_out=4 rejected=0 parse_errors=1 row_groups=1 bytes=2588
malformed / rejected rows → piped.parquet.rejects.jsonl (1 parse, 0 shaped-out)
3. Inspect it
inspect reads the Parquet footer only; it does not scan the data.
$ shapeshift inspect events.parquet parquet file: events.parquet rows: 4 row-groups: 1 columns (8): active: Boolean amount: Float64 day: Date32 event_at: Timestamp(Microsecond, None) id: Int64 tags: Utf8 user.name: Utf8 user.plan: Utf8
4. Land an Iceberg table instead
Same input, same inference, one flag. The output is a table directory that needs no catalog server to write or to read.
$ shapeshift shape -i examples/events.jsonl -o events_tbl --to iceberg shaped `events` → events_tbl (Iceberg) rows_in=4 rows_out=4 rejected=0 parse_errors=1 row_groups=1 bytes=3212 malformed / rejected rows → events_tbl.rejects.jsonl (1 parse, 0 shaped-out) iceberg table metadata → events_tbl/metadata/v1.metadata.json $ shapeshift inspect events_tbl iceberg table: events_tbl format-version: 2 table-uuid: 80004ff4-ed67-4b47-a7ed-d9bf1eb826e3 current-snapshot-id: 2904320289415383880 total-records: 4 columns (8): active: boolean amount: double day: date event_at: timestamp id: long tags: string user.name: string user.plan: string $ find events_tbl -type f events_tbl/data/ba8dddb1-820c-4f5b-9807-684a58d2d4d0.parquet # data, PARQUET:field_id 1..N events_tbl/metadata/fa85a8ef-6767-46c8-873c-647aaa93403e-m0.avro # manifest events_tbl/metadata/snap-2904320289415383880-1-2675e053-2927-42de-a3a1-e77d6a347ddd.avro # manifest list events_tbl/metadata/v1.metadata.json # table metadata events_tbl/metadata/version-hint.text
The data file carries PARQUET:field_id on every column and the Avro manifests
keep their field-id attributes. That chain is what makes the directory a table an
Iceberg reader can open, not Parquet in a folder.
5. Read it back with DuckDB
The acceptance gate is an engine shapeshift did not write. Both outputs return the same rows and the same aggregate:
INSTALL iceberg; LOAD iceberg;
SELECT count(*) AS n, sum(amount) AS total FROM read_parquet('events.parquet');
-- 4 | 115.49
SELECT count(*) AS n, sum(amount) AS total
FROM iceberg_scan('events_tbl', allow_moved_paths = true);
-- 4 | 115.49
SELECT id, "user.name", amount, day
FROM iceberg_scan('events_tbl', allow_moved_paths = true) ORDER BY id;
-- 1 | Ada | 12.5 | 2026-07-13
-- 2 | Grace | 3.0 | 2026-07-13
-- 3 | Linus | 99.99 | 2026-07-12
-- 4 | Edsger | 0.0 | 2026-07-11
allow_moved_paths. A table's paths are absolute: anchored where it was
written. This check read the table in a Linux container from a different path than the one it
was written at, so it passed allow_moved_paths = true. Read where it was written,
iceberg_scan('events_tbl') needs no flag; the repository's own check does exactly
that with DuckDB 1.5.4.
6. Pin the shape with a strict spec
Inference is where you start, not where you stay. examples/billing.spec.yaml is a
hand-written strict spec: it writes only the columns it declares, selects nested paths,
and rewrites values before they are typed.
dataset: billing source: { format: jsonl } output: { format: parquet, path: ./out/billing.parquet, compression: snappy } schema: strict columns: - { name: id, from: id, type: int64, required: true } - { name: plan, from: user.plan, type: string, transform: uppercase } - { name: amount_cents, from: amount, type: int64, transform: dollars_to_cents } - { name: day, from: day, type: date } - { name: event_at, from: event_at, type: timestamp }
$ shapeshift shape -s examples/billing.spec.yaml -i examples/events.jsonl -o billing.parquet
shaped `billing` → billing.parquet (Parquet)
rows_in=4 rows_out=4 rejected=0 parse_errors=1 row_groups=1 bytes=2292
malformed / rejected rows → billing.parquet.rejects.jsonl (1 parse, 0 shaped-out)
schema drift (policy: warn): 1 undeclared field(s) in 3 of 4 rows
new field `tags` — 3 row(s), first at record 1, suggest type json, e.g. ["a","b"]
every row was written as-is; nothing was dropped for drift
to keep the new fields, add to the spec's `columns:`
- name: tags
type: json
required: false
full drift report → billing.parquet.drift.json
The spec has no column for tags, so its values never reach the file. That used to
pass silently; now the run says so, with the declaration to paste if you want to keep it.
What a drift does (warn, rescue, quarantine, fail) is a policy: see
Schema drift.
Next
- Dataset spec — every field, type, transform and policy.
- Iceberg tables — append, upsert with
--merge-on, compact, expire, and concurrent writers. - CLI:
--summary-json— one JSON document per run, for scripts and orchestrators.