
Converting CSV to JSON XML YAML and Excel in Practice
Convert one awkward CSV to JSON, JSON Lines, XML, YAML, Excel, Parquet, Markdown and SQL, read each back and see the cost on 193,708 rows.
The format everyone exports and nobody specifies. Delimiters, quoting, encodings and loading it into a database intact.

Convert one awkward CSV to JSON, JSON Lines, XML, YAML, Excel, Parquet, Markdown and SQL, read each back and see the cost on 193,708 rows.

A cron export that cannot publish a half-written file: lock, temporary name, row-count check, atomic rename. Real cron failed first, on the environment.

Pipe a PostgreSQL export into gzip or zstd: 130 MB became 42 MB in 4.6 s, with six settings compared and the pipeline that exits 0 after a failed export.

One timestamp exported as 09:30+00, 16:30+07 and 04:30-05, and dd.mm.yyyy that pandas read as 3 January. Fix dates and booleans in the query, not the session.

Export a 2,000,000 row table to CSV six ways: peak memory ranged from 11 MB to 2 GB, time from 1.6 s to 14 s. fetchall and pandas are the ones that run out.

Export SQLite to CSV with a header row from the sqlite3 shell: CRLF endings by default, NULL against empty string, types and 2,000,000 rows in 3.5 s.

mongoexport writes CSV only if you name the fields. See arrays, ObjectIds, nulls, the empty file and exit 0 on a typo, and 500,000 documents in 2.7 s.

Export an Oracle query to a quoted CSV with SQLcl: set the CSV format, spool to a file, fix date and number formats, and run it from a shell script.

How to export a SQL Server query to a real CSV with bcp: add the header row, quote fields yourself, fix dates and NULLs, and pick the right encoding.

JSON Lines or CSV for event exports? Measured file size, compressed size and read time on 200,000 events, plus nesting, sparse fields and null handling.

INTO OUTFILE writes on the server and its popular recipe corrupts newlines and NULLs: 4 of 8 rows read back. A variant reads 7, a client script reads 8.

Export a PostgreSQL query to CSV with psql: NULL against empty string, delimiter and quoting options, encodings, why variables fail and the file left behind.
We send one email when a new article is published. No spam.