
Converting a CSV to Parquet With DuckDB in One Line
One COPY statement turns a CSV into Parquet in DuckDB. See the schema it writes, fix zip and money columns, compare compression codecs, and verify the result.
Answers from raw rows: aggregates, cohorts, funnels, time series, plus the string and text wrangling that precedes every report.

One COPY statement turns a CSV into Parquet in DuckDB. See the schema it writes, fix zip and money columns, compare compression codecs, and verify the result.

Use ignore_errors and store_rejects in DuckDB to read past bad CSV rows, then query reject_errors to see which lines were dropped and why.

A date column with five formats makes DuckDB fall back to text. Parse it with try_strptime and coalesce, list the failures, and avoid the day-first trap.

When the DuckDB CSV sniffer picks the wrong type, override it by column, read as text and cast, or narrow the candidate types. A test file shows each guess.

Fix field name is not valid, reference is not valid, fields that vanish after refresh, old items that stay, lost formatting and new rows that never appear.

Read every CSV in a folder as one table in DuckDB with a glob, add the file name as a column, and handle files whose columns differ in count or order.

Show values as percent of total in an Excel pivot, then write the same share in SQL with SUM OVER and avoid integer division and rounding traps.

How the DuckDB CSV sniffer picks delimiter, header and types, how to read its verdict with sniff_csv, and what breaks when a bad value sits past the sample.

The read_csv options that solve real problems in DuckDB 2.0, each on a file that needs it, including the nullstr trap that replaces the empty default.

Turn a wide Excel sheet with a column per month into a long table: LATERAL VALUES in PostgreSQL, UNPIVOT or CROSS APPLY in SQL Server, UNION ALL in MySQL.

Install DuckDB, point it at a CSV and query it. Covers the file name shortcut, DESCRIBE, SUMMARIZE, reading from a pipe and writing CSV back out.

Pivot in MySQL with SUM and CASE, and in SQL Server with the PIVOT operator. Includes dynamic column lists built with prepared statements and QUOTENAME.
We send one email when a new article is published. No spam.