Skip to content

Instantly share code, notes, and snippets.

@vladox
Last active November 3, 2016 11:25
Show Gist options
  • Save vladox/587e8b90fa4180ee450838a2fba8700c to your computer and use it in GitHub Desktop.
Save vladox/587e8b90fa4180ee450838a2fba8700c to your computer and use it in GitHub Desktop.
Export a SQL query result in Postgres to a CSV file.
COPY(select * from your_table_name) TO '/the/path/to/your/file/your_table_name.csv' WITH CSV DELIMITER ',' HEADER;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment