Thursday, 4 June 2015

Output to a CSV file from a Postgres query

Write the query in script_name.sql file. Run:



        psql database --no-align -F"," -P "footer=off" --quiet -f script_name.sql -o output_file.csv

No comments: