On Friday, January 20, 2012 9:17:53 PM UTC-8, Michael Bayer wrote: > > > On Jan 20, 2012, at 6:59 PM, Justin Thiessen wrote: > > <snip description of confusion regarding contains_eager and multi-level > joins> >
> contains_eager(User.job, alias=job_alias) > contains_eager(User.job, Job.desk, alias=desk_alias) > > both are needed since the User->job->desk load can't take place unless Job > objects are being loaded in the results. > Thanks! This is exactly what I was trying to figure out. I had misinterpreted: http://docs.sqlalchemy.org/en/latest/orm/loading.html#contains-eager to indicate that you could supply a single contains_eager option to join multiple tables at once. My code now works as expected, and I get the benefit of a single SQL query for joins on large datasets, which is not inconsiderable. Cheers, Justin Thiessen -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/9MzTOMT7XNoJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
