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

SQLAlchemy + Postgres Cheatsheet 10 — Upsert, RETURNING, and COPY

Cheatsheet: ON CONFLICT DO UPDATE / DO NOTHING, RETURNING, bulk insert via execute(insert(), list), asyncpg COPY.

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

Postgres SQLAlchemy Textbook Ch. 10 — Replication, Failover, and pgvector

Streaming replication, read replica routing, failover handling in SQLAlchemy, and using pgvector for embeddings.

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