
Importing a CSV Into MySQL With a Header Row and Odd Quotes
Skip a header with IGNORE 1 LINES, then handle doubled quotes, backslashes, embedded newlines and Windows line endings that LOAD DATA treats differently.
Take messy CSV, JSON and spreadsheets and land them in tables without losing a row or a character on the way.

Skip a header with IGNORE 1 LINES, then handle doubled quotes, backslashes, embedded newlines and Windows line endings that LOAD DATA treats differently.

Two switches control LOAD DATA LOCAL, one on the server and one on the client, each failing with its own error code. Enable both safely and know the risk.

Error 1290 blocks LOAD DATA INFILE and INTO OUTFILE outside one directory. Find the allowed path, move the file there, or switch to LOCAL and know the cost.

Every clause of LOAD DATA INFILE that matters for a CSV, from the tab default to NULL handling, with the output of each variant on MySQL 8.4.

LOAD DATA LOCAL turns bad values into warnings and still reports success. Import a CSV into MySQL safely, with a script that checks before it swaps.

Stream a CSV from a web address straight into COPY with curl. See what a 404 and a cut off download do to a plain pipe, and the guards that fix it.

Stream a gzipped CSV into PostgreSQL with gunzip and COPY, time it against unpacking first, and see what a truncated archive does to a pipe.

PostgreSQL 17 can skip rows with bad values during COPY. See ON_ERROR, REJECT_LIMIT and verbose logging in action, and the errors they do not cover.

PostgreSQL loads an unquoted empty field as NULL and a quoted one as an empty string. See the options that change that and the integer error one causes.

Load a messy CSV as text first, then convert it with SQL. Build a three format date parser, a reject table with reasons, and the typed insert.

COPY cannot skip file columns. Compare two ways to load three of eight columns of a 2,000,000 row CSV, with timings, and see why cut breaks on quotes.

COPY stops with an invalid byte sequence error when a CSV is Latin 1. Fix it with the ENCODING option or client_encoding, and avoid the SQL_ASCII trap.
We send one email when a new article is published. No spam.