- Home
- Database Migration Tools
- Alembic
Alembic
What it is
Alembic is a free database migration tool for projects using SQLAlchemy. It creates, manages, and runs scripts that change relational database schemas, with a migration environment maintained alongside the project’s source code. Its autogeneration feature compares a database schema with application metadata to propose a migration script; users must review and edit the result.
Alembic can generate SQL scripts without connecting to a database, including for workflows where direct DDL access is restricted. For SQLite, batch operations handle limited ALTER TABLE support by moving data into a newly structured table and replacing the original. Its documented database dialects include PostgreSQL, MySQL, MariaDB, SQLite, and Microsoft SQL Server. Alembic supports Python 3.10 and newer and requires SQLAlchemy 2.0.0 or newer; it can be installed with pip. Autogeneration does not reliably detect table or column renames, and offline SQL generation cannot handle migrations that need client/server database access, such as SELECT queries. Alembic is part of the SQLAlchemy project and is licensed under MIT terms.
For and against
For
- Keeps migration environments with project source code.
- Generates candidate migrations from schema and metadata.
- Can produce SQL without connecting to a database.
- Batch operations address SQLite ALTER TABLE limits.
Against
- Rename detection is unreliable in autogeneration.
- Offline SQL mode cannot run database-dependent migrations.
- Requires Python 3.10 or newer and SQLAlchemy 2.0.0 or newer.
The verdict
Alembic provides migration scripting for SQLAlchemy projects, with both database-connected and offline SQL workflows. Users should plan to inspect generated candidates and account for offline-mode limits.
Who it suits
Alembic suits developers maintaining relational database schemas in SQLAlchemy projects. It is also relevant to teams that need offline SQL generation or SQLite migration support.
Plans and prices
Alembic
Open-source software under the MIT license
Read 3 Oct 2026 · github.com
On the record
- Autogenerate
- Alembic compares database schema with application metadata to generate candidate migration scripts that users review and edit by hand.alembic.sqlalchemy.org · read 3 Oct 2026
- Autogenerate limitation
- Autogenerate does not reliably identify table or column renames and its candidate migrations must be manually reviewed and corrected.alembic.sqlalchemy.org · read 3 Oct 2026
- Database ecosystem
- Alembic uses SQLAlchemy and database drivers, and its documentation describes PostgreSQL, MySQL, MariaDB, SQLite, and Microsoft SQL Server dialect implementations.alembic.sqlalchemy.org · read 3 Oct 2026
- Installation
- Alembic can be installed with pip and is commonly installed in a project-local Python virtual environment.alembic.sqlalchemy.org · read 3 Oct 2026
- License
- The repository license grants permission to use, copy, modify, distribute, and sell the software, subject to its stated conditions.github.com · read 3 Oct 2026
- Maintainer
- Alembic is developed by Mike Bayer and is part of the SQLAlchemy project.alembic.sqlalchemy.org · read 3 Oct 2026
- Migration scripts
- A project's migration environment is created once and maintained with its source code.alembic.sqlalchemy.org · read 3 Oct 2026
- Offline limitation
- Migration scripts that need client/server database access, such as pulling rows with SELECT, will not work in offline SQL generation mode.alembic.sqlalchemy.org · read 3 Oct 2026
- Offline SQL
- Alembic can generate SQL scripts for migrations instead of running them against a database, including for workflows where DDL access is restricted.alembic.sqlalchemy.org · read 3 Oct 2026
- Python support
- Alembic supports Python 3.10 and newer and requires SQLAlchemy 2.0.0 or newer.alembic.sqlalchemy.org · read 3 Oct 2026
- SQLite migrations
- Batch operations support SQLite's limited ALTER TABLE capabilities by copying data into a newly structured table and replacing the old table.alembic.sqlalchemy.org · read 3 Oct 2026
- Support
- The project directs users to GitHub Discussions for bug and feature discussion and its GitHub issue tracker for bug reports and feature requests.alembic.sqlalchemy.org · read 3 Oct 2026
- What it does
- Alembic is a lightweight database migration tool for use with SQLAlchemy and provides tools to create, manage, and invoke relational database change scripts.alembic.sqlalchemy.org · read 3 Oct 2026