SQLAlchemy Async Session in FastAPI: Patterns and Pitfalls
Set up a SQLAlchemy async session in FastAPI with explicit session scope, transaction boundaries and loading strategy to avoid MissingGreenlet and pool starvation.
14 min read
Tag
Set up a SQLAlchemy async session in FastAPI with explicit session scope, transaction boundaries and loading strategy to avoid MissingGreenlet and pool starvation.
14 min read
How a SQLAlchemy async session uses the pool and lazy loads, how to size asyncpg pools, use selectinload, and turn MissingGreenlet errors into explicit loads.
14 min read
Model migrations as an Nx project with explicit inputs and implicit dependencies so nx affected runs migration checks only when schema code changes.
14 min read