Last active
March 26, 2022 13:07
-
-
Save ksoda/2ad7ab4c7996b782a72f263dff761309 to your computer and use it in GitHub Desktop.
This file contains 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
psql -U postgres -h localhost \ | |
-XAtc "SELECT tablename FROM pg_catalog.pg_tables where schemaname='public'" | while read table | |
do psql -U postgres -h localhost \ | |
-c "\copy (SELECT * FROM $table) to $table.csv with csv header" | |
done |
This file contains 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
docker run -it --rm --name="postgres" \ | |
--publish="5432:5432" \ | |
--volume 'postgres-14-data:/var/lib/postgresql/data' \ | |
--env='POSTGRES_HOST_AUTH_METHOD=trust' \ | |
postgres:14 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment