Skip to content

Instantly share code, notes, and snippets.

@aaronmyatt
Created November 19, 2015 02:07
Show Gist options
  • Save aaronmyatt/c17a84d4d27075764832 to your computer and use it in GitHub Desktop.
Save aaronmyatt/c17a84d4d27075764832 to your computer and use it in GitHub Desktop.
postgres to json
# output to /tmp due to file permissions, but you could write to any file if you're running locally.
\copy (SELECT row_to_json(t) FROM (SELECT * FROM partner_stockrecord) t) to /tmp/partner_stockrecord.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment