Forums

Import postgres DB

My website is running ok, I created a new postgres DB. However, I want to import my local postgress DB. What are the steps?

We have a help page on how to do backups of postgres and you can use that to take a backup of you local posgres and then restore it on PythonAnywhere

postgres-# pg_restore --host=XXX.postgres.pythonanywhere-services.com --port=12181 --username=XXX --format=c --file=/home/XXXX/XXX/BACKUP.sql current_db_name

the command doesn't work. Where is the problem? :\

You're trying to run a program from a postgres console, run that in a Bash console.

In the bash console, nothing happens. I will press enter and I have to stop the command CTRL-Z

18:32 ~/RealEstate (main)$ pg_restore --host=northuni-XXX.postgres.pythonanywhere-services.com --port=12181 --username=super --file=realestate2.backup

There are 3 backups: realestate2.backup realestate3 realestate4.sql and it's the same with all of them.

Other attempt: pg_restore -h northuni-XXX.postgres.pythonanywhere-services.com -p 12181 -U super -d artif -1 realestate4.sql pg_restore: [archiver] unsupported version (1.14) in file header

Ctrl-Z is not stopping your command but putting it into the backgroud. How big is your database? How long did you wait?

23KB is very small, I waited 10 minutes for something to happen

It looks like you need to upgrade the Postgres client tools for your account -- if you go to the "Databases" page, there is a command displayed for you to run in Bash to update them.