Skip to content

Instantly share code, notes, and snippets.

@mrgcohen
Last active July 17, 2019 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrgcohen/75d05b30471f5040895ae16a174c1b54 to your computer and use it in GitHub Desktop.
Save mrgcohen/75d05b30471f5040895ae16a174c1b54 to your computer and use it in GitHub Desktop.
Export db query to file through stdout postgres
psql -h host -U username dbname -c "copy (select * from table) TO STDOUT WITH CSV" >> data.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment