Alembic

Database migrations tool for SQLAlchemy with autogenerate and transactional DDL

Tool
PyPI
v1.20.1
4,456 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
90 /100 Excellent
Development Activity 96
Maintenance 100
Community 64
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
88 /100 Excellent
Architecture 88
Code Quality 90
Innovation 87
Learning Curve 80

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 27 apps in this directory

Python
69%
Apache 2.0

Agent Control

AI Agents

330

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
83
Repo Health
71
Technical
67
Dependency
Built with
Python 69%
TypeScript 30%
Updated 1 weeks ago
TypeScript
55%
Other

agenta

AI Development · Developer Tools · Devops

4,856

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

View details
91
Repo Health
77
Technical
66
Dependency
Built with
TypeScript 55%
Python 40%
Updated 6 days ago
Python
87%
Apache 2.0

Apache Airflow

Data Engineering

47,268

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
64
Dependency
Built with
Python 87%
Updated 6 days ago
Python
59%
Apache 2.0

argilla

AI Development · Data Engineering

5,175

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
61
Dependency
Built with
Python 59%
Jupyter Notebook 21%
Updated 1 weeks ago
Python
59%
Other

Arkon

AI Assistants · Knowledge Management · Mcp

1,496

Self-hosted enterprise AI knowledge hub that compiles internal docs into a scoped, reviewable wiki and serves it to Claude and other LLMs through an MCP server.

View details
45
Repo Health
74
Technical
70
Dependency
Built with
Python 59%
TypeScript 41%
Updated 4 months ago
Python
62%
MIT

AutoGen

AI Development · Automation

61,546

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
68
Repo Health
78
Technical
71
Dependency
Built with
Python 62%
C# 25%
TypeScript 12%
Updated 2 weeks ago
TypeScript
48%
AGPL 3.0

Banana Slides

AI Design Tools · Productivity

15,853

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

View details
84
Repo Health
82
Technical
68
Dependency
Built with
TypeScript 48%
Python 47%
Updated 6 days ago
Python
100%
GPL 3.0

ComfyUI

AI Design Tools · AI Development

142,410

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
Python 100%
Updated 6 days ago
Python
44%
MIT

/dev/push

Developer Tools · Devops

4,775

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
43
Repo Health
68
Technical
73
Dependency
Built with
Python 44%
HTML 31%
CSS 17%
Updated 8 months ago

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