
Diffing YAML Files Without Whitespace Noise or Reordering
diff -w hides YAML indentation changes that alter meaning. Normalize both files with yq sort_keys and compare as data to ignore layout and order only.
Tag
47 posts

diff -w hides YAML indentation changes that alter meaning. Normalize both files with yq sort_keys and compare as data to ignore layout and order only.

Deep-merge a base and an override with yq eval-all, choose whether lists replace or append, and check what a null or an empty value in the override does.

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.

A messy file with nine findings, reported by yamllint line by line, then repaired with yq and a project config. The workflow that finds and fixes indentation.

Load a CSV into MongoDB with mongoimport: what its type guessing does to zip codes, how to declare types, skip blanks and upsert on a key, with real runs.

Load CSV into ClickHouse with clickhouse-client and FORMAT CSVWithNames, tune delimiter, errors and dates, and check a file first with clickhouse-local.

Load a CSV from Cloud Storage into BigQuery with bq load: explicit schema, bad-record limits, quoted newlines, replace versus append and a job ID for reruns.

csvkit and Miller timed on the same 200,000-row file. Type inference makes csvkit's sort, stat and JSON commands 100 times slower and can rewrite your dates.

Turn a CSV into a browsable, searchable, filterable website with sqlite-utils and Datasette, with a JSON and CSV API, facets and full-text search built in.

Build and read JSON in Bash without breaking: jq --arg instead of string concatenation, newlines in values, exit codes, null as text and filter injection.

Load a CSV into SQLite with one sqlite-utils command, set a primary key, control type detection, add full-text search, and see what 2 million rows cost.

Four CSV validators run on the same broken files: qsv validate, csvkit csvclean, CSVLint and Frictionless. What each reports, how it exits and which to use.