All quizzesHard
Session & Production Behavior — Series 2
Preview — 3 of 10 questions
A FastAPI endpoint uses SQLAlchemy AsyncSession. Why should expire_on_commit=False often be considered for response serialization?
AIt avoids implicit attribute reloads after commit that async code cannot perform through normal property access
BIt turns every query into a synchronous query
CIt disables database transactions
DIt makes all relationships eager automatically
A list endpoint serializes related Teams for 100 Heroes. Which loading strategy commonly reduces N+1 queries?
ACall session.refresh on each row one at a time
BEager-load the relationship with a suitable loader such as selectinload
CConvert every row to a dict before querying
DDisable all foreign keys
A helper calls session.commit() midway through an endpoint that must update two tables atomically. What is the risk?
AFastAPI combines both commits into one transaction automatically
BThe first table becomes read-only
CThe helper ends the transaction before the endpoint can roll back both changes
DThe second write is guaranteed to succeed
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.