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 2.0 Textbook Ch. 7 — Transactions and Concurrency

Transactions and concurrency: isolation levels, savepoints, FOR UPDATE locking, optimistic locking, retry patterns, and the cross-DB differences.

May 7, 2026 · 4 min · 724 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

SQLAlchemy Cheatsheet 08 — Performance, N+1, Bulk Ops, Streaming

Cheatsheet: detect N+1, bulk insert/update, yield_per, load_only, defer, EXPLAIN, slow query logging.

May 12, 2026 · 3 min · 459 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 2.0 Textbook Ch. 8 — Async SQLAlchemy in Depth

Async patterns in SQLAlchemy 2.0: AsyncSession, expire_on_commit, async streaming, lazy loading caveats, AsyncSession scopes.

May 7, 2026 · 5 min · 880 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

SQLAlchemy Cheatsheet 09 — Migrations Integration (Alembic)

Cheatsheet: Alembic setup with SQLAlchemy 2.0, env.py for sync/async, naming conventions, common ops.

May 12, 2026 · 3 min · 486 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 2.0 Textbook Ch. 9 — Performance: N+1, Bulk Ops, Streaming

Practical SQLAlchemy performance: avoiding N+1, bulk_insert_mappings, server-side cursors, EXPLAIN ANALYZE patterns.

May 7, 2026 · 4 min · 764 words · Manvendra Rajpoot