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

SQLAlchemy Cheatsheet 10 — Production Patterns

Cheatsheet: PgBouncer, read replica routing, OTEL instrumentation, multi-tenancy (RLS), DR / failover.

May 12, 2026 · 3 min · 494 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

SQLAlchemy 2.0 Textbook Ch. 10 — Migrations and Schema Evolution

Schema migrations: Alembic integration, autogenerate, manual edits, branching, online schema changes, deploy patterns.

May 7, 2026 · 3 min · 599 words · Manvendra Rajpoot

SQLAlchemy + Postgres Cheatsheet 11 — Partitioning

Cheatsheet: declarative partitioning, partition creation, query pruning, pg_partman automation.

May 13, 2026 · 2 min · 306 words · Manvendra Rajpoot

SQLAlchemy Cheatsheet 11 — Events and Hooks

Cheatsheet: engine events (connect/checkout/before_cursor_execute), session events (before_commit), mapper hooks (before_insert/update/delete), attribute events.

May 12, 2026 · 3 min · 566 words · Manvendra Rajpoot

SQLAlchemy 2.0 Textbook Ch. 11 — Testing

Testing SQLAlchemy: real DBs via testcontainers, per-test transactions, factory_boy, async fixtures, and CI patterns.

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

SQLAlchemy + Postgres Cheatsheet 12 — pgvector (Embeddings)

Cheatsheet: vector column, HNSW vs IVFFlat, cosine / L2 / inner-product distance, RAG hybrid filter.

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

SQLAlchemy + Postgres Cheatsheet 12 — Schema-Per-Tenant

Cheatsheet: per-tenant schemas, search_path, multi-schema Alembic env, onboarding.

May 13, 2026 · 2 min · 358 words · Manvendra Rajpoot

SQLAlchemy Cheatsheet 12 — Repository and Unit-of-Work Pattern

Cheatsheet: repository classes, unit-of-work, generic base repo, service-layer separation.

May 12, 2026 · 3 min · 633 words · Manvendra Rajpoot