Make sure migration is atomic #25
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
https://docs.sqlalchemy.org/en/13/orm/session_api.html#sqlalchemy.orm.session.sessionmaker
https://docs.sqlalchemy.org/en/13/orm/session_transaction.html#unitofwork-transaction
But migrations use methods of module
alembic
and not SQL Alchemy directly.changed milestone to %1
changed the description
This depends on the DDL. MySQL is non-transactional by Alembic's design. Nowadays MySQL does support transactions so Alembic should probably be changed.
As a workaround we could emit
START TRANSACTION;
andCOMMIT;
manually at the start and end of the migration.Turns out, transactions in MySQL suck. E.g.
CREATE TABLE
can't be rolled back.Thus, we cannot ensure atomic migrations.
closed