'How to use a standalone Operations instance and rollback changes?
The Alembic documentation states that "a standalone Operations instance can be made for use cases external to regular Alembic migrations by passing in a MigrationContext". An example is given:
from alembic.migration import MigrationContext
from alembic.operations import Operations
conn = myengine.connect()
ctx = MigrationContext.configure(conn)
op = Operations(ctx)
op.alter_column("t", "c", nullable=True)
How can this be done as a transaction? In other words, how can these operations be rolled back?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|