Postgres export to a CSV
Snippet
Instead of being asleep at 10:31 on 16 November 2023, kitt created this:
Easy export to a CSV file, with headers.
# sql \COPY (SELECT * FROM report_view_table) TO 'export.csv' DELIMITER ',' CSV HEADER; # bash psql $DATABASE -c "\COPY (SELECT * FROM report_table) TO 'export.csv' DELIMITER ',' CSV HEADER;"
Add new comment