Django Python pg_dump export database postgresql


Here is a quick snippet to export postgresql:

1
command = ‘export PGPASSWORD=PASSWORD_HERE\npg_dump -U USERNAME_HERE-h localhost DATABASE_HERE| gzip > %s’ % FILEPATH_HERE

os.system(command)


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.