My suggestion is to use PostgreSQL's dump / restore features directly using pg_dump and psql .
With pg_dump you can unload a specific table from the local database
$ pg_dump --data-only --table=products sourcedb > products.sql
Then take the Heroku PostgreSQL connection string from the configurations
$ heroku config | grep HEROKU_POSTGRESQL # example # postgres:
and restore the table to the remote database using information obtained from Heroku.
$ psql -h ec2-117-21-174-214.compute-1.amazonaws.com -p 6212 -U user3123 db982398 < products.sql
You will need to configure the -p , -h and -U options, as well as the database name. Password will be requested using psql .
You can also use pg_restore to filter the dump and restore the table, but I personally prefer psql .
Please note that Heroku recommends using PostgreSQL tools in several documents, such as Import and Export for Big Data, or whenever the provided CLI commands are not distributed for example, in this question.
Simone carletti
source share