Alembic autogenerate creates an empty migration even though models changed
@devsingh05▲ 10 net votes
Autogenerate compares the database against target_metadata in env.py, which only knows about models that have been imported. Set target_metadata = Base.metadata and make sure env.py imports the module(s) defining every model (import app.models). Also check the alembic.ini or env.py database URL points at the same database you are inspecting, and that the database is already at head (alembic upgrade head) before generating.