Alembic Textbook Ch. 3 — Writing Migrations Manually
Manual migrations: op API, ALTER patterns, batch ops for SQLite, data migrations, idempotent migrations.
Manual migrations: op API, ALTER patterns, batch ops for SQLite, data migrations, idempotent migrations.
All Pydantic v2 validation hooks: field_validator, model_validator, mode=before/after, custom validators via Annotated.
Postgres index types via SQLAlchemy: B-tree, GIN, GiST, BRIN, HASH, partial, expression, INCLUDE indexes, and concurrent creation.
Schema in SQLAlchemy 2.0: typed mapped columns, Python types vs DB types, defaults, indexes, constraints, table_args.
Request validation with Pydantic v2: BaseModel, Field, validators, custom types, error responses, nested models, discriminated unions, and the FastAPI integration.
Alembic branching: how multiple revisions create branches, merging strategies, and team workflows.
Output side: model_dump, model_dump_json, field/model serializers, exclude/include, mode=python/json, by_alias.
Practical full-text search in Postgres via SQLAlchemy: tsvector, GIN, websearch_to_tsquery, ranking, and stemming.
Session deep dive: lifecycle, identity map, flush, commit, expire_on_commit, refresh, the unit of work.
Output side of FastAPI: response_model, response shaping, custom encoders, status codes, response classes (JSON, HTML, Streaming, File).