I wonder if there is an easy way to dump or load the content of just one table to heroku shared database (postgres). There is pgbackups addon reccomended by heroku but according to docs it supports dumping and loading the whole database.
What I need is to just dump/load single table.
You can use Taps (https://devcenter.heroku.com/articles/taps) to pull data down from your PG database. Using Taps, you can do specific table(s), like such:
heroku db:pull --tables users
You can do more than one table as well where the table names are comma delimited, like:
heroku db:pull --tables users,posts
Edit: As some comments have pointed out, taps has been deprecated and replaced.
New mechanism is through pg:pull
and pg:push
which can be seen by their new docs (https://devcenter.heroku.com/articles/heroku-postgresql#pg-push-and-pg-pull).
No longer supporting individual tables, you can pull the db to your local by the following example:
heroku pg:pull HEROKU_POSTGRESQL_MAGENTA mylocaldb --app sushi
or updating the remote from your local:
heroku pg:push mylocaldb HEROKU_POSTGRESQL_MAGENTA --app sushi
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With