All posts
Tag

sqlalchemy

5 posts

Tutorial

Clean Code Python: Full-Stack DI with dependency-injector, FastAPI, and SQLAlchemy

FastAPI's Depends() handles per-request wiring. dependency-injector handles everything else — configuration, singletons, factories, and a declarative container that makes your entire object graph visible in one file.

15 min read
Tutorial

Clean Code Python: Connection Pooling and Database Resilience Under Load

Your pool_size=5 default just met Black Friday traffic. 200 concurrent requests, 5 connections, 195 coroutines waiting on pool checkout — then timeouts cascade into a full outage. Here is how to configure connection pooling, read replicas, and circuit breakers for production traffic.

14 min read
Tutorial

Clean Code Python: Async Patterns That Actually Scale

asyncio.gather() is not always the answer. Here is when to parallelize database calls, when NOT to, and how to avoid the most common SQLAlchemy async session mistakes that cause subtle production bugs.

9 min read