Re:Our SQL interview questions
by jschmitz28 on Tuesday May 28, 2013 @01:30PM
(#5781294)
It does not apply to the first question, but how does the ORM handle joined columns from other tables? Is it embedded somewhere in the returned object? The best way I could think to handle this using an ORM would be for the object to contain a set of arbitrary key/value pairs to contain joined columns but it seems like a hack.
[ Parent
| on HN ]
Re:Our SQL interview questions
by megaman821 on Tuesday May 28, 2013 @06:16PM
(#5783225)
It is fetched dynamically e.g. employee.boss.department. That will usually cause two more queries to the database. You can use select_related and prefetch_related so that these objects will be loaded into the ORM in one or two queries.