How to run a migration with Python Alembic by code?
问题 I am trying to migrate a SQL database using sqlAlchemy and Alembic. I would like to make simple migration scripts directly in Python code, and not by using Alembic CLI, as described in the docs. I only found this SO question on this topic: Using Alembic API from inside application code Using this question + Flask-Alembic source code, I tried these simple commands. engine is linked to my db & metadata contains the information for the migration. I think I am very close, and the solution should