Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Dump PostgreSQL Table in docker container as CSV file
CONTAINER="name"
DB="Db name"
TABLE="Table Name"
FILE="file.csv"
sudo docker exec -u postgres ${CONTAINER} psql -d ${DB} -c "COPY ${TABLE} TO STDOUT WITH CSV HEADER " > ${FILE}
@medcharaabipro

This comment has been minimized.

Copy link

@medcharaabipro medcharaabipro commented Sep 4, 2020

Thx, it was exactly what I'm looking for.

@TheBunk92

This comment has been minimized.

Copy link

@TheBunk92 TheBunk92 commented Dec 29, 2020

I've been battling with trying to get this to work for ages! You have saved me! Thanks!

@LukasPol

This comment has been minimized.

Copy link

@LukasPol LukasPol commented Jan 15, 2021

How to set my password??

@tutorialcreation

This comment has been minimized.

Copy link

@tutorialcreation tutorialcreation commented Jun 23, 2021

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment