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.

closed as unclear what you're asking by mustaccio, Colin 't Hart, McNets, Mr.Brownstone, Marco Jan 10 at 14:33

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • It might help to talk about the specific steps you're having trouble with. – RDFozz Jan 11 at 16:15

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!

  • After executing the first instruction you suggested, a SQL file was generated. Proud of this I tried to shoot him on heroku, but without success. After a full day of attempts, I found that the reason was that the company's connection does not allow access to the databases on Heroku, and therefore the problem was insurmountable, using the company's connection. So as soon as I made an attempt with another connection, everything worked wonderfully! Instead of continuing with your tutorial though, I used the following command to upload the sql file to Heroku heroku pg:psql --app myapp < file.sql – Guglielmo Lischi Jan 10 at 12:37
  • Did you try SFTP using a tool like Putty? – Vérace Jan 10 at 16:14
  • I'm not very practical with putty. But I assume it can be very cumbersome as a matter. Fortunately, this solution came to mind. Seeing that on the web there was often a reference to the firewall regarding the postgreSQL-Heroku question, the company filters came into my mind and in fact, after a few seconds, with another connection, everything worked. :) – Guglielmo Lischi Jan 11 at 13:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.