Can I run pg_restore during a migration? #851
Unanswered
maresb
asked this question in
Usage Questions
Replies: 1 comment
-
if this operation is in the midst of an actual migration, put the database connection into autocommit mode using autocommit_block. all transactional state will be removed. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using Alembic with a PostgreSQL database. The
pg_restore
command can be used to restore certain tables from a backup file. I would like to runpg_restore
during a migration.I tried this, and it did not work. The problem appears to be a deadlock, as the migration's connection locks out the connection from the
pg_restore
process.Suppose I have a migration script whose only job is to run a
pg_restore
process. Is there any way to temporarily close the connection so thatpg_restore
and then subsequent scripts can run?If I were to try to solve this myself, I would alternate between Alembic and
pg_restore
, using Alembic to run the migrations between backup scripts. But this feels like an inelegant hack, and I'm hoping for a better way. Thank you!Beta Was this translation helpful? Give feedback.
All reactions