FastAPI - Dependency Injection
You need to create a shared dependency in FastAPI that provides a database session and ensures the session is closed after the request completes. Which implementation correctly achieves this?
yield to provide setup and teardown logic.yield to provide the session and close it after yielding -> Option A15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions