2 ms·
consider that the "rendering of a SELECT string" is only like 10% of what the ORM is doing for you when you create and run `session.query()`. There is: 1. mapp
by zzzeek 11y ago
consider that the "rendering of a SELECT string" is only like 10% of what the ORM is doing for you when you create and run `session.query()`. There is: 1. mapping the columns in the SELECT statement to the object attributes 2. dealing with the execution, result set, unicode, type conversion, etc. etc. idiosyncrasies of the underlying database driver as well as the target database backend, 3. routing various parts of each result row not just to different attributes on the mapped class but also into related attributes and collections of other classes all at the same time (e.g. eager loading) 4. maintaining the unit of work / identity map semantics as these rows are loaded 5. presenting the result set as a hierarchical object structure rather than a straight list of rows.