[Sqlalchemy-tickets] Issue #2982: enhance association_proxy to support specifying fetch strategy (z
Brought to you by:
zzzeek
|
From: Ezra E. <iss...@bi...> - 2014-03-03 22:20:34
|
New issue 2982: enhance association_proxy to support specifying fetch strategy https://bitbucket.org/zzzeek/sqlalchemy/issue/2982/enhance-association_proxy-to-support Ezra Epstein: I've encountered a use case where being able to override the default fetch strategy of the underlying relationships would come in handy. In this case the underlying relationships are both lazy - a one-to-many (backref) to a intermediate join table, followed by a to-one to the target table for the association. There are good reasons for each to be lazy "joins" (separate select statement required). However, when the association_proxy is accessed I would like to indicate that the second relationship should be fetch eagerly using an (inner) join. Without that the association_proxy ends up giving rise to the N+1 select problem. I do have several work-around via the org Query APIs directly. Would be very nice, however, to be able to do this directly via a mapped attribute. Thanks for considering it. (Or clarifying what I may be doing wrong if this is already a feature!) |