For installation and the full user documentation, see the Query Farm Shellfs documentation.
When the command runs gzip, disable DuckDB's automatic compression explicitly.
Otherwise a destination ending in .gz can cause DuckDB to compress the CSV before
the pipe compresses it again.
COPY (SELECT * FROM range(3) AS t(n)) TO '| gzip > out.csv.gz'
(FORMAT CSV, HEADER, COMPRESSION UNCOMPRESSED);
SELECT * FROM read_csv('out.csv.gz');