Domanda

I'm almost a novice with databases. I created a PostgreSQL database with the python programming language.
I am pleased to note that the database was created as I wished. I could easily verify it from pgAdmin 4, the database administrator installed locally.
But now, since it is ready to be used, I would like to upload it to Heroku in order to work with it inside my web application.
I followed the various steps slavishly on the site of Heroku, but I can not complete the various steps, especially at the following command:

set DATABASE_URL=postgres://$(whoami)

I wonder if it's an operating system problem, in the sense that the steps listed on the Heroku site could be os-agnostic and not addressed to Windows, the system I'm working on. I also believe that some commands are directed to connect the database that is located locally, not to migrate on the domain of Heroku.

È stato utile?

Soluzione

First, take a dump of the db under Windows as outlined here. This will be a human readable text file - worth a look to get a feel for what's going on "under the hood", i.e. in the background!

Then, ftp that file (as text) over to the Heroku box (Linux I presume) and do a restore from the dump as outlined here.

psql dbname < infile

You may have to create an empty schema - can't remember.

Then use psql to connect to your new db.

p.s. a word to the wise - if you're going to be using Python, Heroku and PostgreSQL, then you should be using a Linux box as your main machine - all three are Linux "natives" rather than Windows. Try it out - you'll wonder how you ever did things any other way!

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a dba.stackexchange
scroll top