Store result of a PostgreSQL query as a CSV file

Executes a query against a Postgres database and writes the output to a new file

Authored by: sorin
Brought to you by Warp, a free terminal reimagined to work like a modern app.
query
file_name

Command
Copy
psql -d dbname -t -A -F"," -c "query" > file_name
Tags