Skip to content Skip to sidebar Skip to footer

Using Pg_restore On Dump File

I have a database on Heroku I'm trying to copy to my local machine. I created a backup of the database by doing: heroku pgbackups:capture This create a dump file of the database wh

Solution 1:

Heroku does not allow you to use sqlite files, as they have a read only file system. But you can use Django to dump the data from Heroku into a JSON file via the dumpdata command, and them import that into your local dev environment.

Because it can be difficult to run commands that generate files on the web server using heroku run, I suggest you instead install django smuggler, which makes this operation a point and click affair in admin.

enter image description here

Solution 2:

First of all you should install postgres in your local machine.

PostgreSQL cheat sheet for django beginners

Then, import your dump file with pg_restore command:

pg_restore -d yournewdb -U yournewuser --role=yournewuser /tmp/b001.dump

Thats all, your data is now cloned from your heroku app.

Post a Comment for "Using Pg_restore On Dump File"