On 07/19/2016 05:20 PM, Martijn van Oosterhout wrote:
On 19 July 2016 at 18:42, Mike Bayer <[email protected] <mailto:[email protected]>> wrote: On 07/19/2016 12:33 PM, Martijn van Oosterhout wrote: On Sunday, July 17, 2016 at 8:47:11 AM UTC+2, Martijn van Oosterhout wrote: But in any case, even this improves performance greatly. this is adequate for a new recipe if you are interested in adding it. Also I think sqlalchemy-utils provides a feature along these lines but I'm not sure how well it works or handles those harder cases like chained relationships. Thanks. On the way home though I had a thought: wouldn't it be simpler to run the original query with yield_from(), and then after each block run the query with a filter on the primary keys returned, and add all the joinedload/subqueryload/etc options to this query, run it and rely on the identity map to fix it for the objects returned the first time. Or is that something we cannot rely on?
it works for the loading you're doing, where the primary keys of what's been fetched are fed into the subsequent query. But it doesnt work for current subquery loading which does not make use of those identifiers, nor for joined loading which does OUTER JOIN onto the original query at once (doing "joinedload" as a separate query is essentially what subquery loading already is).
Have a nice day, -- Martijn van Oosterhout <[email protected] <mailto:[email protected]>> http://svana.org/kleptog/ -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
-- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
