On Apr 25, 2007, at 12:25 AM, Andreas Jung wrote:

>
> hmm..Why has this to do with self-referential mappers? Wouldn't the  
> generated SQL be same if it wasn't a self-referential mapper but  
> just mapper with a property for a one-to-many relationship?

well no, the eager load paradigm is:

select table1.*, table2.* from table1 LEFT OUTER JOIN table2 on  
table1.someid=table2.someid

if table1 and table2 are the same table, you have to alias table2,  
but also the single LEFT OUTER JOIN only gets you the first level of  
joins.  if your recursive structure is 4 levels deep you dont get  
much.  theres other recursive issues involved there which I prefer  
not to get involved in, in favor over forcing the user to come up  
with an exact query that loads the self-referred rows in a way thats  
tailored to the application.


> And it's not about eager loading. I am perfectly fine with lazy  
> loading. I am just saying that the generated SQL for lazy-loading  
> the 'tools' property isn't perfect. A left join would be much  
> faster but I don't know if it is possible to influence that on the  
> configuration level?!

well i just noticed youre sticking an external table into your  
primaryjoin....but i see nothing there that implies the usage of a  
LEFT OUTER JOIN ?  are you saying that you dont need the rows from  
AMH_View to be present ? how could SA possibly know that ?  (if not,  
please send me the exact query being produced, and the exact query  
you think should be produced)



--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to