On this page
Overview
Alembic is a database migration tool built on SQLAlchemy. It manages schema changes as Python revision scripts with upgrade and downgrade paths, autogeneration, transactional DDL, branch merging, and SQLite-oriented batch migrations.
Features and best fit
Based on official documentation; not hands-on tested · Content checked:
Key features
Version schema changes through migration environments and revision scripts
alembic init creates a project-specific migration environment, and each revision can define upgrade() and downgrade() operations. Connection setup and script templates remain customizable for application-specific database and release workflows.
Autogenerate candidate migrations from model metadata and the live schema
Alembic can compare SQLAlchemy MetaData with the current database schema and render candidate migration directives. It also supports transactional DDL, branch and merge workflows, and batch table recreation for SQLite-style ALTER limitations.
Best fit
Fits Python backends that want schema evolution as reviewable source-controlled history
It is useful when SQLAlchemy models and database schemas evolve continuously and teams need reproducible upgrade paths committed with application code, including parallel development represented through the revision graph.
Before adoption
Treat autogenerate output as a draft and review the new 1.20.0 constraint warnings
Autogenerate produces candidate migrations that require manual review. Alembic 1.20.0 requires Python 3.10+ and SQLAlchemy 2.0+, and it adds warnings around unnamed CHECK constraints and drop operations without constraint names. Review naming conventions and downgrade behavior before applying a migration.
Official sources
- [1]sqlalchemy/alembic — GitHub repository(2026-10-06)
- [2]Alembic 1.20.0 — README(2026-10-06)
- [3]Alembic 1.20.0 — pyproject.toml(2026-10-06)
- [4]Alembic 1.20.0 tutorial(2026-10-06)
- [5]Alembic 1.20.0 autogenerate documentation(2026-10-06)
- [6]Alembic 1.20.0 release(2026-10-06)
- [7]Alembic MIT license(2026-10-06)
Supplemental curator note
Autogenerate reduces the initial migration authoring work, but it is not a substitute for review. Treat constraint names, data migrations, and downgrade reversibility as explicit code-review concerns.
Try it in 3 steps
- 1
Install Alembic 1.20.0 and SQLAlchemy
Pin Alembic in the same Python environment as the target project.
python -m pip install "alembic==1.20.0" "SQLAlchemy==2.1.3" - 2
Create a migration environment
Follow the official tutorial to generate alembic.ini, env.py, the versions directory, and related templates.
alembic init alembic - 3
Create the first revision and inspect history
Verify revision generation without applying database changes. Configure the target connection and review upgrade operations before running them against a real database.
alembic revision -m "baseline" && alembic history
Growth
Growth trends · Last 30 days
4,431 Stars
Trend data is still being collected.
Built with
Categories and tags
Categories
GitHub data
GitHub dataView detailed GitHub data
GitHub Topics
- python
- sql
- sqlalchemy
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- Kotlin JDSL825 Stars
3 shared tag(s) · 2 shared category(s)
build JPA queries from ordinary Kotlin classes without generated metamodels
Kotlin - Komapper344 Stars
3 shared tag(s) · 2 shared category(s)
unify JDBC and R2DBC with a Kotlin DSL and compile-time metamodels
Kotlin - sqlmap38,611 Stars
3 shared tag(s) · Same language
automate SQL injection testing for explicitly authorized web applications
Python - redis-py13,648 Stars
2 shared tag(s) · 2 shared category(s) · Same language
use synchronous, asynchronous, and cluster Redis access through one Python client
Python - DBeaver51,964 Stars
2 shared tag(s) · 2 shared category(s)
operate many database systems from one desktop SQL workspace
Java - Turso Database24,632 Stars
2 shared tag(s) · 2 shared category(s)
run SQLite-compatible SQL on a Rust database engine with bindings for multiple languages
Rust
Report incorrect information
Tell us if any listing information is incorrect or outdated.