Created
April 2, 2016 12:30
-
-
Save leemour/41417bd608336735ebaa27ea67d704c7 to your computer and use it in GitHub Desktop.
Export selected records from DB to file dump - Postgres
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For a data-only export use COPY. | |
# You get a file with one table row per line as plain text (not INSERT commands), it's smaller and faster: | |
COPY (SELECT * FROM nyummy.cimory WHERE city = 'tokio') TO '/path/to/file.csv'; | |
# Import the same to another table of the same structure anywhere with: | |
COPY other_tbl FROM '/path/to/file.csv'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment