On Oct 14, 2014, at 4:41 PM, Jonathan Vanasco <[email protected]> wrote:

> give this example:
> 
>     class Foo():
>         bars = relationship("Bar")
> 
>     class Bar():
>         foos = relationship("Foo")
> 
>     loaded_Foo = s.query(Foo)
> 
> is it possible to issue a subqueryload for `bars` on the collection of 
> `loaded_Foo` objects ?
> 
> I strongly doubt it, but figure it is worth asking.  SqlAlchemy never ceases 
> to amaze me.


I assume you mean that loaded_foo is s.query(Foo).all().

the subqueryload wants access to the original query to wrap.     as you've seen 
before, 
https://bitbucket.org/zzzeek/sqlalchemy/issue/3037/support-setting-load-options-on-instances
 could provide an API to make this more easily possible, and of course if you 
wanted to dig into the strategy API internals it would be possible now but 
would require some effort.

though for the moment you might want to just use the old recipe: 
https://bitbucket.org/zzzeek/sqlalchemy/wiki/UsageRecipes/DisjointEagerLoading

-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to