Alembic Textbook Ch. 5 — Online Schema Changes (Zero-Downtime Patterns)

Zero-downtime migrations: expand-contract, batched backfills, CONCURRENTLY, NOT VALID FK, and pg_repack.

May 10, 2026 · 4 min · 783 words · Manvendra Rajpoot

Pydantic v2 Textbook Ch. 5 — Nested Models, Generics, and Discriminated Unions

Composing models: nesting, generics with TypeVars, discriminated unions, recursive models.

May 9, 2026 · 3 min · 471 words · Manvendra Rajpoot

Postgres SQLAlchemy Textbook Ch. 5 — Locking, Advisory Locks, and SKIP LOCKED

Postgres locking patterns: SELECT FOR UPDATE, NOWAIT, SKIP LOCKED, advisory locks, application locks, deadlock retry.

May 8, 2026 · 4 min · 651 words · Manvendra Rajpoot

SQLAlchemy 2.0 Textbook Ch. 5 — Querying with select()

Selecting rows in SQLAlchemy 2.0: select(), where, joins, group_by, aggregates, subqueries, CTEs, scalars vs rows.

May 7, 2026 · 5 min · 952 words · Manvendra Rajpoot

FastAPI Textbook Ch. 5 — Dependency Injection in Depth

Dependency injection in FastAPI: Depends, scopes, sub-deps, class-based deps, lifecycle (startup/shutdown), and the patterns from production.

May 6, 2026 · 6 min · 1170 words · Manvendra Rajpoot

Alembic Textbook Ch. 6 — Multi-Database and Multi-Tenant Migrations

Multi-DB migrations via Alembic: -t multidb template, schema-per-tenant strategies, parallelism.

May 10, 2026 · 3 min · 607 words · Manvendra Rajpoot

Pydantic v2 Textbook Ch. 6 — Custom Types and TypeAdapter

Custom types via Annotated, RootModel for primitive-typed root, TypeAdapter for arbitrary types, dataclass integration.

May 9, 2026 · 3 min · 595 words · Manvendra Rajpoot

Postgres SQLAlchemy Textbook Ch. 6 — LISTEN / NOTIFY for Pub/Sub

LISTEN/NOTIFY patterns: real-time event delivery, queue wake-up, payload limits, and combining with the outbox pattern.

May 8, 2026 · 3 min · 553 words · Manvendra Rajpoot

SQLAlchemy 2.0 Textbook Ch. 6 — Relationships and Loading Strategies

Relationship() in depth: configuration, loading strategies, N+1 prevention, association tables, polymorphic patterns.

May 7, 2026 · 5 min · 884 words · Manvendra Rajpoot

FastAPI Textbook Ch. 6 — Authentication and Authorization

Auth and authz in FastAPI: passwords, JWT, OAuth2 / OIDC, sessions, passkeys, RBAC, scopes, and security best practices.

May 6, 2026 · 6 min · 1129 words · Manvendra Rajpoot