Bug: Inconsistent Database State and Partial Migration Applied After Error in Alembic Auto-Generated Migration #1594
Unanswered
SimiHack
asked this question in
Usage Questions
Replies: 1 comment 2 replies
-
when using the mssql dialect (I assume that's what you're using), transactional DDL is applied by default. you would see this in the logging output that alembic generates. so assuming alembic raised an error, it rolls back the whole transaction which for transactional DDL includes everything it did from the beginning of the connection. I would advise setting the log level for SQLAlchemy to INFO which will show the point at which ROLLBACK or COMMIT is emitted. if your database and/or odbc driver is putting the connection into autocommit mode, then this wont work. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello Alembic Community,
I am encountering an issue when using Alembic migrations with SQLAlchemy and the Azure Database ODBC Driver. Here's the problem in detail:
Steps to Reproduce:
test_column
) in the ORM model.test_column
) along with the new column.Issue:
Ideally, when an error occurs, the entire migration should be rolled back, and no changes should be applied to the database. However, in this case, the new column was added despite the error. Additionally, the Alembic version table was not updated to reflect the migration's partial application.
Questions:
Looking forward to your insights!
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions