On Aug 14, 2009, at 11:26 PM, David Bolen wrote:

> then a query like:
>
>    query(ClassPeriod).join(Class_, Session).\
>                       options(contains_eager('class_','session'))
>
> doesn't seem to perform the eager loading:
>
>    SELECT class_periods.class_id AS class_periods_class_id,
>    class_periods.weekday AS class_periods_weekday,
>    class_periods.start_time AS class_periods_start_time,
>    class_periods.duration AS class_periods_duration,  
> weekdays_1.weekday
>    AS weekdays_1_weekday, weekdays_1.day AS weekdays_1_day
>    FROM class_periods JOIN classes ON classes.class_id =
>    class_periods.class_id JOIN sessions ON sessions.session_id =
>    classes.session_id LEFT OUTER JOIN weekdays AS weekdays_1 ON
>    weekdays_1.weekday = class_periods.weekday

>
>
> but if I add the intermediate class_ relationship:
>
>    query(ClassPeriod).join(Class_, Session).\
>                       options(contains_eager('class_'),
>                               contains_eager('class_','session'))

mapper options always take a full path from the root class of the  
query and indicate one relation() each, with the exception of  
eagerload_all().   this may not be ideal for the usual  
contains_eager() use case though.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@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