alembic
Installation
SKILL.md
Alembic
Overview
Alembic is the migration tool for SQLAlchemy. It records schema changes as versioned Python scripts, each pointing at its parent revision, and stores the current revision in an alembic_version table. It can autogenerate scripts by comparing your models with the live database, run data migrations, handle branches, and emit plain SQL for review. Checked against Alembic 1.20 (September 2026), which requires Python 3.10+.
Instructions
Step 1: Setup
pip install alembic
alembic list_templates # generic, async, multidb, pyproject, pyproject_async
alembic init migrations # sync driver (psycopg, pymysql, sqlite)
alembic init -t async migrations # async driver (asyncpg, aiosqlite, aiomysql)
Set the database URL in alembic.ini (sqlalchemy.url) or override it in env.py from an environment variable such as DATABASE_URL; do not commit passwords. Then point env.py at your models: