I am using Postgres on Heroku and am needing to dump one table from my production DB and dump it into my staging DB. I have the heroku tool belt installed, but am not sure how to dump a single db table to import into my staging db.
相关问题
- How to specify memcache server to Rack::Session::M
- Django distinct is not working
- PostgreSQL: left outer join syntax
- Connecting Python to a Heroku PostgreSQL DB?
- PostgreSQL - Deleting data that are older than an
相关文章
- postgresql 关于使用between and 中是字符串的问题
- postgresql 月份差计算问题
- Using boolean expression in order by clause
- Table valued Parameter Equivalent in Postgresql
- in redshift postgresql can I skip columns with the
- Oracle equivalent of PostgreSQL INSERT…RETURNING *
- Django/Heroku: FATAL: too many connections for rol
- Heroku Web Server Won't Start Locally
Take a look at taps (
db:pull
), your use case is covered by this answered question, I believe.You can dump a single table of data like so:
You can get all of the values needed with this:
This will prompt you for your password. Enter it, and you should then proceed to get a file
table.dump
on your local drive.You probably want to truncate the table on staging:
With that file, you can use
psql
with theConnection URL:
output of a new call topg:credentials
for the staging app and restore just that table.@catsbys answer
I needed to add the port as well
pg_dump --no-acl --no-owner -h [host ip].compute-1.amazonaws.com -p [port] -U [user name] -t [table name] --data-only [database name] > table.dump