Joining to ClassA.b does not include an automatic upgrade of ClassB to also load it's joined inheritance table ClassC. This is actually something SQLAlchemy can't quite do yet unless you hardwired a "with_polymorphic" onto your ClassB, which means it would join to ClassC all the time. 0.8 has a new with_polymorphic() feature which gets closer, but still contains_eager() is not smart enough to do it yet - this is ticket #1106 related to ticket #2438. May or not be doable in 0.8 depending on how things go.
The only option for now, short of hardwiring ClassB to be with_polymorphic->ClassC, is to load ClassB + ClassC separately with query(ClassB).with_polymorphic(ClassC), using a "subqueryload" approach, then affixing them to each parent - see the recipe at http://www.sqlalchemy.org/trac/wiki/UsageRecipes/DisjointEagerLoading . On May 31, 2012, at 6:47 AM, Francesco wrote: > Hello everyone, > I have a big problem that alone can not solve. > There are tens of days I try to figure out how to solve this problem. > I created a little test to make you understand better. > > http://pastebin.com/hdqR5P6G > > I need to know the value of d.CODE with a single query on ClassA. > I need get a list of ClassA object but eager load d.CODE in > polymorphic parent. > > Is there anyone who can help me? > > Best regards, > Francesco > > -- > 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. > -- 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.