At a glance
| Supported databases | SQLAlchemy dialects: PostgreSQL, MySQL, MariaDB, SQLite, Oracle, SQL Server, plus external dialects |
| Migration approach | Versioned Python revisions in a revision graph |
| Schema diff and generation | Autogenerate compares SQLAlchemy models with the database; table and column renames are not detected |
| Rollback | alembic downgrade runs the downgrade() functions you write or review |
| CI/CD and automation | CLI and Python API; offline mode outputs SQL for review |
| Language or runtime | Python 3.10 or later, with SQLAlchemy |
| Licensing | MIT, no paid edition |
Alembic is the natural choice for a Python application whose tables are defined with SQLAlchemy: it drafts revisions from model changes, supports downgrades and can render migrations as SQL scripts for review. It is free with no paid tier, but it ties migrations to Python, and autogenerated revisions always need a manual check.
Overview
Alembic describes itself as a lightweight database migration tool for use with the SQLAlchemy Database Toolkit for Python, and it is written by SQLAlchemy's author, Mike Bayer. Each migration is a Python revision file with upgrade() and downgrade() functions that call operations such as op.create_table or run raw SQL, and the database's current revision is stored in an alembic_version table.
Revisions form a graph rather than a strict line, so branches can be created and merged. Because SQLAlchemy renders the SQL, Alembic works with the dialects SQLAlchemy supports: PostgreSQL, MySQL and MariaDB, SQLite, Oracle and SQL Server, plus externally maintained dialects. Alembic 1.20.1 (22 October 2026) requires Python 3.10 or later.
Key features
- Python revision files with upgrade() and downgrade() functions
- Autogenerate drafts revisions by comparing SQLAlchemy metadata with the database (tables, columns, nullability, indexes, unique and foreign key constraints)
- Offline mode renders migrations as SQL scripts instead of running them
- Branching and merging of revision histories
- Batch mode for SQLite and other databases with limited ALTER TABLE support
- Works with every SQLAlchemy dialect, including external ones such as Snowflake and BigQuery
Pros and cons
Pros
- Free and MIT licensed, with no paid tier
- Autogenerate drafts migrations from SQLAlchemy models
- Downgrades are part of every revision
- Offline mode produces SQL scripts for DBA review
Cons
- Python and SQLAlchemy only; services in other languages cannot share the migrations
- Autogenerate misses table and column renames (seen as drop and add) and anonymously named constraints
- The documentation says autogenerated candidate migrations must always be reviewed and corrected
Pricing
Alembic is free and open source under the MIT licence, with no paid edition.
Pricing checked on the vendor's official page on 7 November 2026. Prices change; confirm before buying.
Who it is best for
Python applications that define their tables with SQLAlchemy and want migrations generated from, and kept next to, the models.
Who should look elsewhere
- Databases shared by services in several languages, where a language-neutral tool fits better: see Liquibase vs Alembic.
- Teams that want migrations to be plain SQL files: see Flyway vs Alembic.
Verdict
For a Python service built on SQLAlchemy, Alembic is the default migration tool: free, mature and integrated with the models. Its limits are the language boundary and the need to review every autogenerated revision, especially renames.
Frequently asked questions
Does Alembic work without the SQLAlchemy ORM?
Yes. Alembic needs SQLAlchemy, but you can write revisions by hand with op operations or raw SQL. Autogenerate needs SQLAlchemy table metadata to compare against, which can come from Core tables or ORM models.
Can Alembic detect renamed columns?
No. The autogenerate documentation says table and column renames appear as a drop and an add, so you edit the revision to use a rename instead.
Is Alembic free for commercial use?
Yes. It is released under the MIT licence and has no paid edition.
Sources
Checked November 2026.
How we research reviews and what star ratings mean: our editorial method.