Alembic Cheatsheet 02 — Commands
Cheatsheet: complete list of alembic CLI commands with flags and common scenarios.
Cheatsheet: complete list of alembic CLI commands with flags and common scenarios.
Cheatsheet: Field options, constraints (min/max/gt/le/pattern), defaults, default_factory, aliases.
Cheatsheet: DeclarativeBase, Mapped/mapped_column, type mappings, server_default, indexes, unique/check/FK, naming conventions.
What Alembic autogenerate detects (tables, columns, indexes, constraints) and what it doesn’t (data migrations, complex changes, defaults), plus a review checklist.
Field declaration, types (str, int, datetime, UUID, Decimal, EmailStr, HttpUrl), constraints, defaults, aliases.
Engine and connection management: pool types, sizing, pre-ping, recycle, events, debugging.
Cheatsheet: @dataclass, @define, frozen, slots, field, validators.
Cheatsheet: schema vs model separation, partial updates, ORM-to-API conversion, nested relations.
Cheatsheet: autogenerate detection rules, common misses (renames, data, defaults), drift detection.
Cheatsheet: field_validator (mode=before/after), model_validator, BeforeValidator/AfterValidator, ValidationInfo.