Flask-migrate: 'Lock wait timeout exceeded; try restarting transaction' error on upgrade/downgrade

Created on 3 Aug 2018  路  1Comment  路  Source: miguelgrinberg/Flask-Migrate

Hi. I use Flask-Migrate==2.2.1, Flask-SQLAlchemy==2.3.2
The project has 4 MySQL InnoDB databases, so I used --multidb param on init.
Upgrade and downgrade are ending with an error:
sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (1205, 'Lock wait timeout exceeded; try restarting transaction') [SQL: u"INSERT INTO alembic_version (version_num) VALUES ('2b912072f47f')"] (Background on this error at: http://sqlalche.me/e/e3q8)
Please help

Most helpful comment

The problem solved. It turned out that I had the same values for default DB engine (SQLALCHEMY_DATABASE_URI) and first of SQLALCHEMY_BINDS, hence there were two attempts to save alembic_version into the same database. I fixed that and the problem is gone.

>All comments

The problem solved. It turned out that I had the same values for default DB engine (SQLALCHEMY_DATABASE_URI) and first of SQLALCHEMY_BINDS, hence there were two attempts to save alembic_version into the same database. I fixed that and the problem is gone.

Was this page helpful?
0 / 5 - 0 ratings