Alembic

Database migrations tool for SQLAlchemy with autogenerate and transactional DDL

Tool
PyPI
v1.19.1
4,328stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
85/100Excellent
Development Activity84
Maintenance92
Community64
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
88/100Excellent
Architecture88
Code Quality90
Innovation87
Learning Curve80

Alembic is a lightweight database migration tool written by the author of SQLAlchemy. It manages the incremental, versioned evolution of your relational schema through migration scripts organized as a directed-acyclic graph, letting you upgrade and downgrade a database through simple, ordered steps.

Beyond hand-written migrations, Alembic can autogenerate candidate migration scripts by comparing your SQLAlchemy models against the live database, emit changes as transactional DDL, and render migrations to plain SQL for DBA-driven workflows. It supports branching, merging, and multi-root version graphs, and includes batch (move-and-copy) migrations to work around SQLite’s limited ALTER support.

What You Get

  • A CLI-driven migration workflow with revision, upgrade, downgrade, history, and stamp commands
  • Autogeneration of candidate migrations by diffing SQLAlchemy models against the live database schema
  • A concise operations API (op.add_column, op.alter_column, op.create_table) that avoids re-declaring full Table structures
  • Non-linear, dependency-graph versioning with support for branches, multiple roots, and merge points
  • Batch (move-and-copy) migrations that bring SQLite’s limited ALTER support into the fold
  • The ability to render migrations to plain SQL scripts for offline or DBA-controlled deployments

Common Use Cases

  • Evolving a production database schema safely across application releases
  • Autogenerating migration scaffolding from changed SQLAlchemy models to eliminate boilerplate
  • Producing SQL migration scripts for environments where direct DDL access is restricted
  • Coordinating schema changes across feature branches using merge and branch migrations

Under The Hood

Architecture

Alembic layers a CLI front-end over a scriptable migration engine. alembic/config.py exposes a CommandLine class and main() entry point (registered as the alembic console script) that parse arguments into a Config object and dispatch to functions in alembic/command.py (revision, upgrade, downgrade, stamp). Those commands load a ScriptDirectory (the on-disk migration graph) and an EnvironmentContext/MigrationContext from the project’s generated env.py, which establishes database connectivity. Schema changes are expressed through the op proxy (alembic/op.py, alembic/operations/) that builds minimalist DDL constructs on top of SQLAlchemy’s DDLElement, while alembic/autogenerate/ inspects the live schema and diffs it against model metadata to render candidate scripts via Mako templates.

Tech Stack

Pure Python (targeting 3.10+) with SQLAlchemy (>=1.4.23) as the core schema-inspection and DDL engine, Mako for migration-script templating, and typing-extensions for typing support. The package ships py.typed and .pyi stubs (op.pyi, context.pyi) for full type coverage. Build tooling uses setuptools; development uses nox (noxfile.py), tox, pytest with pytest-xdist, and a comprehensive flake8 lint suite.

Code Quality

The repository is mature and disciplined: 35 test modules under tests/, an inline type-checked codebase (py.typed, stub files, mypy configuration), and an extensive flake8/pydocstyle/import-order lint stack. As part of the SQLAlchemy project it follows the same rigorous coding standards, with production-stable classifiers and a long, consistent release history.

API Design

The developer experience is strong. Migration scripts read declaratively thanks to the op API, where operations like op.add_column() or op.rename_table() are single, self-documenting calls. The CLI mirrors familiar DVCS concepts (revisions identified by UUID-like hashes, branches, merges), and alembic init scaffolds a working environment from selectable templates. Documentation at alembic.sqlalchemy.org is thorough, though the underlying migration concepts carry an inherent learning curve.

Used by 25 apps in this directory

Python
66%
Apache 2.0

Agent Control

AI Agents

295

An open-source runtime control plane for AI agents — define safety guardrails once, apply them across agents built on LangChain, CrewAI, Google ADK, or AWS Strands, and update controls without redeploying code.

View details
79
Repo Health
71
Technical
70
Dependency
Built with
Python66%
TypeScript33%
Updated yesterday
TypeScript
59%
Other

agenta

Developer Tools · Devops · AI Development

4,489

The open-source LLMOps platform unifying prompt engineering, evaluation, and observability for teams building reliable LLM applications.

View details
91
Repo Health
77
Technical
67
Dependency
Built with
TypeScript59%
Python39%
Updated today
Python
90%
Apache 2.0

Apache Airflow

Data Engineering

46,530

Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.

View details
96
Repo Health
89
Technical
66
Dependency
Built with
Python90%
Updated today
Python
59%
Apache 2.0

argilla

AI Development · Data Engineering

5,081

Collaborate on high-quality AI training data with a self-hosted annotation platform built for LLMs, NLP, and multimodal models.

View details
65
Repo Health
81
Technical
63
Dependency
Built with
Python59%
Jupyter Notebook21%
Updated 2 days ago
Python
62%
MIT

AutoGen

AI Development · Automation

60,518

Build autonomous and human-in-the-loop multi-agent AI systems with a layered, event-driven Python and .NET framework pioneered at Microsoft Research.

View details
57
Repo Health
78
Technical
75
Dependency
Built with
Python62%
C#25%
TypeScript12%
Updated 4 months ago
TypeScript
48%
AGPL 3.0

Banana Slides

AI Design Tools · Productivity

15,476

AI-native PPT generator with Vibe editing, multi-LLM support, and fully editable PPTX export

View details
83
Repo Health
82
Technical
71
Dependency
Built with
TypeScript48%
Python47%
Updated 3 days ago
Python
100%
GPL 3.0

ComfyUI

AI Design Tools · AI Development

128,363

The most powerful node-based AI workflow engine for creating images, video, 3D models, and audio with full control over every generation step.

View details
92
Repo Health
81
Technical
75
Dependency
Built with
Python100%
Updated today
Python
44%
MIT

/dev/push

Developer Tools · Devops

4,742

Self-hosted, open-source Vercel alternative that deploys Python, Node.js, PHP, and any Docker-compatible app from a Git push, with zero-downtime rollouts and real-time logs.

View details
44
Repo Health
68
Technical
73
Dependency
Built with
Python44%
HTML31%
CSS17%
Updated 5 months ago
Python
64%
MIT

Flowfile

Data Engineering

341

Visual ETL that compiles to Polars — build pipelines on a canvas, export as standalone Python, and run anywhere without platform lock-in.

View details
83
Repo Health
81
Technical
66
Dependency
Built with
Python64%
Vue19%
TypeScript16%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search