
Extracting Properties Into Typed Columns Nightly From JSON
A nightly job that turns jsonb event properties into a typed facts table in PostgreSQL: safe casts, a watermark, idempotent inserts and a 47x speedup.
Everything you need to level up your coding skills.

A nightly job that turns jsonb event properties into a typed facts table in PostgreSQL: safe casts, a watermark, idempotent inserts and a 47x speedup.

Four designs for the same 500,000 purchase events compared on size and query time: verbose nesting, short flat keys, hybrid columns and key/value arrays.

Read a package metadata document where version numbers are keys: json_each, DuckDB MAP inference, semver sorting, dist-tags versus max, and the time map.

Convert YAML to JSON with PyYAML and ruamel.yaml, and handle dates, yes and no, octal numbers, non-string keys, anchors, multiple documents and floats.

Convert JSON to YAML with yq, Python's yq and a PyYAML one-liner, and see which strings get corrupted by YAML 1.1 readers: NO, yes, 12:30, 0123 and 1e3.

Name CSV columns in the user's words, keep a stable internal key and accept aliases on import. A mapping function tested on three realistic headers.

Move big CSV exports into a job: chunk by key, write to storage, send an expiring link, track progress and clean up. Keyset chunks beat OFFSET.

Stream a CSV download instead of building it in memory: one million rows took 336 MB as an array and 2 MB streamed. Headers, buffering and limits.

Report CSV import errors users can act on: line, column, value and rule, all problems per row, and a file of rejected rows to fix and re-upload.

Preview a CSV import safely: inspect the file, then run the real import in a transaction that rolls back to count creates, updates and errors.

What a CSV import screen needs so users succeed: a template, clear limits, column mapping, a preview, plain-language errors and a count before commit.

Build CSV import and export into an application: staged imports with dry runs, streamed and background exports, column names, round trips and safety.
We send one email when a new article is published. No spam.