On Sep 13, 2010, at 11:45 AM, Michael Bayer wrote:

> 
> 
> In the specific case you have above, you can also use a trick which is to use 
> contains_eager():
> 
> parents = session.query(Parent).options(joinedload(Parent.children), 
> contains_eager(Parent.children, Child.parent)).all()
> 
> the above approach requires that Parent is one of the entities that you're 
> requesting explicitly - i.e. if you were saying joinedload("foo", "bar", 
> "bat"), it would be kind of impossible to target "bat.hohos" with 
> contains_eager() due to the aliasing.

so let me also back that up, that we've always planned on adding an 
"immediateload" option that would just fire off any lazyloader as the query 
fetches results.    A really short patch that adds "immediateload()" is at 
http://www.sqlalchemy.org/trac/ticket/1914 and hopefully will be in 0.6.5 
pending further testing.   



-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to