John Gallagher
John Gallagher

Reputation: 6268

How do I restore three items from a backup made using Heroku PG Backups?

I've got a Rails app running on Heroku and installed the free pgbackups addon.

There's three records I'd like to restore from the backup.

According to Heroku docs when you do a restore, it restores the whole database.

How do I restore just these three records?

Upvotes: 0

Views: 517

Answers (2)

Greg Smith
Greg Smith

Reputation: 18176

As far as I know Heroku is using what's referred to as the "-Fc" format for everything, which is described in the pg_dump section of the manual as the custom format. That can't be read by anything but pg_restore, so you're limited to what it knows how to do. You can get pg_restore to only process a single table, which can speed things up if your database is big and you only care about a few records in one table. But there's no way to only get a few records restored out of there; you'll have to restore the entire table they're in and then dump them back out.

Upvotes: 1

Chap
Chap

Reputation: 3563

Create a new database, load the pgbackup into it, and then cherry pick what you want out of it.

Upvotes: 2

Related Questions