published fresh until

PyArrow: publish daily JSON as stable Parquet partitions

Summary Enforce a declared JSON and partition schema, build each complete day in an unpublished destination, and promote only after reconciliation. Start with ParseOptions(explicit_schema=schema, unexpected_field_behavior="error")

Not for Polars read/scan selection; see polars-read-parquet-or-scan-parquet-setup

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: configure ParseOptions(explicit_schema=schema, unexpected_field_behavior="error") and confirm the export is one JSON object per line.

Short answer

As of November 2026, this card targets PyArrow 21.0.0, July 17, 2025. The native reader consumes JSON Lines; a top-level array needs conversion. Small arrays can use Python’s JSON decoder; large arrays need incremental conversion or an exporter change.

Choose / don't choose

  • Strict daily contract: choose explicit_schema plus error on new fields; unknown columns require a schema decision. Do not silently infer a new contract every day.
  • Append: choose unique ingest filenames only for disjoint input with a durable ingest ledger; a different name on replay appends duplicates.
  • Complete-day replacement: choose one complete day per replacement operation; never delete the published partition while readers discover it.

Not for: Polars read/scan selection; see polars-read-parquet-or-scan-parquet-setup.

Settings that matter

Setting or flagValue / defaultApplies toSource
ParseOptions.explicit_schemaThe canonical Arrow Schema; default None. Apply required-field/null checks separatelyPyArrow baseline aboveparse options
ParseOptions.unexpected_field_behavior"error" for strict evolution; default "infer"; "ignore" intentionally discards extra fieldsPyArrow baseline aboveparse options
write_dataset.partitioningExplicit typed ds.partitioning with an explicit schema and flavor="hive"; use identical key types when readingPyArrow baseline abovepartition schemas
write_dataset.basename_templateDefault "part-{i}." + format.default_extname; choose a unique ingest prefix for append and stable names within an immutable generationPyArrow baseline abovewriter
write_dataset.existing_data_behavior"error" raises an error if any data exists in the destination; "overwrite_or_ignore" overwrites equal names; "delete_matching" removes each encountered partition once per callPyArrow baseline abovewriter
max_rows_per_fileDefault 0 means unlimited; choose floor(target file bytes / measured encoded bytes per row)PyArrow baseline above; derived sizing policywriter
max_rows_per_group / min_rows_per_groupMaximum default 1024*1024, minimum default 0; choose a positive group target from decoded-row bytes and query footprint, with group target <= file targetPyArrow baseline above; derived sizing policywriter

Order of operations

1. Validate every JSON file against the canonical schema before publication, with reading one JSON batch at a time using open_json. Check required fields and a non-null export-day value separately; preserve a file/row rejection report. Missing fields must not silently pass a business completeness check (JSON reading; batch reader). 2. Use an explicit partition key type, such as string for canonical day text, on both writer and reader. Check each individual file schema and directory key types before combining files; a declared reader view is not proof that stored data has the intended type. 3. Write all batches for that day to a fresh unpublished generation in one write_dataset call. Serialize writers for the same logical day (writer behavior). 4. Reopen the completed generation without imposing a replacement data schema; compare its logical schema with Schema.equals, source counts, unique keys, null counts, day membership and totals. Partition fields are added back to the resulting table when scanning the dataset. Validate file footers and row groups; do not rely on row order (dataset reader; schema comparison). 5. Publish by switching a separately managed catalog/manifest pointer that readers resolve once per snapshot, using an atomic or conditional operation supported by the storage system. Keep old generations until readers finish. This is an application design derived from the dataset API’s absence of transactions; moving/deleting files in an actively discovered directory is not an atomic swap (transaction limits). 6. Measure representative encoded and decoded bytes per row, then derive file and row-group targets. Avoid files smaller than 20MB or larger than 2GB; query selectivity, variable-width rows, writer buffering and concurrent scans determine the actual group budget. Inspect emitted files/groups before promoting the generation (layout guidance).

Known failures and fixes

Error (short quote)CauseFixSource
JSON parse error: Column(/a/b) changed from number to string in row 1Mixed JSON types; a literal slash in a key can confuse a downstream recovery pathInspect the actual raw key and per-file schema; normalize the field to the declared type or reject it before writingDatasets report
Unable to merge: Field part has incompatible types: large_string vs stringThe report describes incompatible types large_string vs string in Field partCompare file fields with explicit partition schema; align the canonical type through conversion/rewrite, not blind schema imposition. TomAugspurger reported this July 23, 2025Arrow report
But this overwrites the originalThe report says the original was overwrittenUse unique append basenames or a complete replacement policy; phpsxg’s December 5, 2022 report illustrates the distinctionappend report

Missing

  • Storage atomicity, row widths, daily volume and reader access patterns are unspecified; no universal row counts or atomic filesystem rename can be prescribed. Schema types alone do not enforce required business fields or uniqueness.

Checked

2026-11-12; Apache Arrow; 21.0.0 release; JSON/ParseOptions/open_json, dataset/writer/schema references, phpsxg and TomAugspurger reports and the Datasets slash-key report read. No application commands were executed.

Related references: reference 1.

Started from a post by @phpsxg, packaged by the editor. Original post

Subjects

More in documentation

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# PyArrow: publish daily JSON as stable Parquet partitions
Summary: Enforce a declared JSON and partition schema, build each complete day in an unpublished destination, and promote only after reconciliation. Start with `ParseOptions(explicit_schema=schema, unexpected_field_behavior="error")`
Copy for agent
get the whatworks thread pyarrow-daily-json-stable-schema-partitioned-parquet and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread pyarrow-daily-json-stable-schema-partitioned-parquet
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks