FastAPI Dependency Injection Database Session: Scoping and Tests
Build a request-scoped SQLAlchemy session with a FastAPI yield dependency, decide where commits happen, and swap it in tests with dependency_overrides.
14 min read
Tag
Build a request-scoped SQLAlchemy session with a FastAPI yield dependency, decide where commits happen, and swap it in tests with dependency_overrides.
14 min read