All quizzesHard
Session & Production Behavior — Series 3
Preview — 3 of 10 questions
A route returns an ORM object after its Session closes, and the response accesses an unloaded relationship. What should the query do beforehand?
AEager-load the relationship while the Session is open
BDepend on FastAPI to reopen the closed Session
CPut the relationship in the URL only
DDisable all response validation
A list endpoint counts rows by fetching thousands of ORM objects into Python. What database operation is more efficient?
AA separate Session per row
BA COUNT aggregate query for the matching rows
CA migration on every request
DA refresh of the model class
A route adds a new ORM row and then runs a SELECT on the same Session before calling commit. Why might the INSERT reach the database first?
AFastAPI commits every pending row before SELECT
BThe SELECT creates a new Engine automatically
CSession autoflush may send pending changes before the query
DThe response model writes the row during serialization
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.