Pydantic v2 Textbook Ch. 9 — Settings (pydantic-settings)
Pydantic-settings: typed env config, .env, secrets directory, sources, CLI integration.
Pydantic-settings: typed env config, .env, secrets directory, sources, CLI integration.
Postgres-specific bulk operations: ON CONFLICT, RETURNING, bulk insert via execute, asyncpg COPY for huge data.
Practical SQLAlchemy performance: avoiding N+1, bulk_insert_mappings, server-side cursors, EXPLAIN ANALYZE patterns.
Background tasks in FastAPI: BackgroundTasks for fire-and-forget, ARQ / Celery / Dramatiq for reliable jobs, scheduling, and long-running operations.
Pydantic v2 perf tips, hot path optimization, FastAPI patterns, and when to consider msgspec / attrs.
Streaming replication, read replica routing, failover handling in SQLAlchemy, and using pgvector for embeddings.
Schema migrations: Alembic integration, autogenerate, manual edits, branching, online schema changes, deploy patterns.
Testing FastAPI: TestClient and AsyncClient, dependency overrides, real DB testing with testcontainers, factory fixtures, and CI integration.
Testing SQLAlchemy: real DBs via testcontainers, per-test transactions, factory_boy, async fixtures, and CI patterns.
Production observability: structlog with contextvars, OTEL tracing, Prometheus metrics, log/trace correlation, and the patterns that pay back.