sqlalchemy / alembic

A database migrations tool for SQLAlchemy.
MIT License
2.76k stars 241 forks source link

Flask, Alembic, PGSQL: Migration hangs after upgrade to 1.13.2 and works ONCE after downgrade to 1.13.0 #1498

Closed BID-Equity closed 3 months ago

BID-Equity commented 3 months ago

Describe the bug We have a comprehensive Flask app with SQLAlchemy and use alembic for schema management. A couple of days ago (we believe with the arrival of 1.13.2), we are not able to execute any alembic command that touches the database (upgrade, migrate, current) but can execute commands that only touch the migration files (e.g. heads). When executing a DB command, the flask app starts but nothing happens. PGSQL is new and empty.

If we rebuild the project with alembic==1.13.0, the command execute nicely ONCE. A second time, it just hangs. alembic==1.13.2, rebuild, alembic==1.13.2, rebuild buys us another single run

Expected behavior We expect 'flask db upgrade' not to silently hang

To Reproduce For us its as described above: empty setup docker-compose start docker exec -ti /bin/bash flask db upgrade works

then flask -db upgrade (or migrate -m '') hangs

Error No output at all. Even with increased log level



**Versions.**
 - OS: Debian 12.2.0-14
 - Python: 3.10
 - Alembic: 3.12.
 - SQLAlchemy:2.0.30
 - Database: 15.4-2.pgdg120+1
 - DBAPI:

**Additional context**

**Have a nice day!**