Alembic Textbook Ch. 7 — CI Integration
Alembic CI patterns: drift detection, migration round-trip tests, dry-run, deploy gates, and pre-merge checks.
Alembic CI patterns: drift detection, migration round-trip tests, dry-run, deploy gates, and pre-merge checks.
When Pydantic coerces vs raises: strict mode, per-field strict, lax/strict tradeoffs at API boundaries.
Postgres declarative partitioning via SQLAlchemy: range/list/hash partitions, pg_partman automation, indexes per partition.
Transactions and concurrency: isolation levels, savepoints, FOR UPDATE locking, optimistic locking, retry patterns, and the cross-DB differences.
Concurrency in FastAPI: async vs sync handlers, the threadpool, AnyIO, blocking traps, structured concurrency, and how to scale.
Production Alembic: deploy strategies, recovery from broken migrations, stamp, manual fixes, and the operational checklist.
JSON Schema from Pydantic: model_json_schema, OpenAPI integration, custom schemas, examples.
Postgres RLS for multi-tenant SQLAlchemy: defining policies, setting tenant context per request, and integration with FastAPI.
Async patterns in SQLAlchemy 2.0: AsyncSession, expire_on_commit, async streaming, lazy loading caveats, AsyncSession scopes.
Real-time FastAPI: WebSockets, broadcast / pub-sub, SSE for one-way streams, StreamingResponse, NDJSON, and disconnect handling.