Skip to content

Instantly share code, notes, and snippets.

@Alexfilus
Created December 9, 2019 11:28
Show Gist options
  • Save Alexfilus/b8165142f13c8e31e43e1815ecbbabd5 to your computer and use it in GitHub Desktop.
Save Alexfilus/b8165142f13c8e31e43e1815ecbbabd5 to your computer and use it in GitHub Desktop.
PG to CSV
psql -U postgres -d name -h host.com -p 5432 -c "COPY (SELECT id, name FROM user LIMIT 10) TO STDOUT With CSV HEADER DELIMITER ',';" > foo_data.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment