On Nov 22, 2012, at 11:16 AM, Martin84 wrote:

> Hi Diana & Michael Bayer,
> 
> you both have exactly the same results/sql queries, but unfortunately my 
> results are different. This is really strange,
> here is my complete python script with my output: http://pastebin.com/CyCs90cW

As a side note, that script is slightly different.  A "lazy='joined'" is added 
to Human.houses.  So after your session.close(), then your query(Woman), you 
get "human JOIN woman" which is the query(Woman), then it also has "LEFT OUTER 
JOIN human_house_table LEFT OUTER JOIN house", which is your Human.houses 
lazy="joined".  I'd usually not use "lazy" at all in a joined inheritance 
mapping, as there are already too many JOINs happening implicitly for there to 
be extra joins like this coming in. 

So then, why you don't see the "subquery".   In 0.7, you need join_depth=1 
here, because otherwise, the ORM sees Woman->Child as Human->Human, which is a 
cycle.  join_depth=1 means, "it's OK to join one time in this cycle".

In 0.8 this was improved so that Woman->Child isn't seen as a cycle, the 
subclass identity is taken into account - so join_depth can be removed.  See 
http://www.sqlalchemy.org/trac/ticket/2481 for a description of this issue.

Overall, 0.8 has a lot of improvements to joined inheritance in conjunction 
with eagerloading and with_polymorphic.  

-- 
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