Alembic set autogenerate model

Alembic create revision autogenerate with comment:

$ alembic -c dev.ini revision --autogenerate -m "adding some tables"

Check upgrade script:

$ cat alembic/versions/

Alembic upgrade metadata with version

$ alembic -c dev.ini upgrade 123xxx

Alembic upgrade metadata with latest version

$ alembic -c dev.ini upgrade head


Python migration with Alembic

$ pip install alembic
$ alembic init --template generic alembic

edit alembic.ini

sqlalchemy.url = mysql://root:@localhost/database_name
$ alembic current
$ alembic revision -m "Init"
$ alembic upgrade head
INFO [alembic.migration] Context impl MySQLImpl. INFO [alembic.migration] Will assume non-transactional DDL. INFO [alembic.migration] Running upgrade None -> 174f01a0ar12, Init