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

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 + Postgres Cheatsheet 06 — Full-Text Search

Cheatsheet: generated tsvector, websearch_to_tsquery, ts_rank, headline snippets, trigram hybrid.

May 13, 2026 · 3 min · 474 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 + Postgres Cheatsheet 07 — Locking, SKIP LOCKED, Advisory Locks

Cheatsheet: row locking, NOWAIT, SKIP LOCKED queue, advisory locks (session and tx scoped).

May 13, 2026 · 3 min · 535 words · Manvendra Rajpoot

Postgres SQLAlchemy Textbook Ch. 7 — Partitioning Strategies

Postgres declarative partitioning via SQLAlchemy: range/list/hash partitions, pg_partman automation, indexes per partition.

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

SQLAlchemy + Postgres Cheatsheet 08 — LISTEN / NOTIFY

Cheatsheet: NOTIFY from a transaction, listen via asyncpg, outbox + LISTEN wake-up pattern.

May 13, 2026 · 3 min · 502 words · Manvendra Rajpoot

Postgres SQLAlchemy Textbook Ch. 8 — Row-Level Security and Multi-Tenancy

Postgres RLS for multi-tenant SQLAlchemy: defining policies, setting tenant context per request, and integration with FastAPI.

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

SQLAlchemy + Postgres Cheatsheet 09 — Row-Level Security for Multi-Tenancy

Cheatsheet: enable RLS, write policies, set tenant per request, application role without BYPASSRLS.

May 13, 2026 · 3 min · 540 words · Manvendra Rajpoot

Postgres SQLAlchemy Textbook Ch. 9 — Upsert, Bulk Insert, and COPY

Postgres-specific bulk operations: ON CONFLICT, RETURNING, bulk insert via execute, asyncpg COPY for huge data.

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