In a SQLAlchemy application, a function returns an object from a repository, and accessing one of its related fields throws DetachedInstanceError. Why does this happen, and how should you organize session handling properly?
~4 min by voice
How to approach it
This checks whether you understand the lifecycle of an ORM object in SQLAlchemy: the object's tie to the session, lazy loading as a hidden SQL query, and the ability to set session boundaries and a relationship loading strategy properly.
The interviewer will ask this question and listen. Think out loud and ask for a hint if you need one. When you're done, pause or tap “That's my answer”. In about a minute, your score and the points you covered show up here.