Comparing
Database migration tool for SQLAlchemy — tracks schema changes as versioned scripts.
Database Abstraction Library
| Metric | alembic | sqlalchemy |
|---|---|---|
| Ecosystem | Python | Python |
| Difficulty | Intermediate | Beginner ✓ |
| Weekly downloads | 3.8M↑ | 0 |
| Latest version | v1.13.2 | v2.0.48 |
| Recipes | 2↑ | 1 |
alembic only
Shared
sqlalchemy only
Any production SQLAlchemy app. Column additions/renames, index creation, constraint changes, data backfills as part of schema migrations.
Use SQLAlchemy in any Python application that talks to a relational database — web apps, data pipelines, ETL scripts. It supports PostgreSQL, MySQL, SQLite, and Oracle, so the same code runs everywhere. It's the standard ORM in the Python ecosystem, with integrations for Flask, FastAPI, and most web frameworks.
Non-SQLAlchemy databases (use Flyway, Liquibase, or Django migrations). Throwaway dev DBs where you can afford to drop and recreate.
SQLAlchemy's full ORM is overkill for simple read-only queries or scripts that just need to run a few SQL statements. For those cases, use the database's driver directly (psycopg2, sqlite3) or a lightweight query builder like databases.
alembic
sqlalchemy