On May 8, 2008, at 10:03 AM, Boldyrev Yaroslav wrote:

>
> I have a "parent-child" relationship and i want to query for update  
> all children with  their parents eager loaded. But that doesn't work  
> as outer joins are not allowed in "SELECT ..FOR UPDATE" queries in  
> postgresql and eagerload always produce outer join.
>
> The only solution (and only for most recent revision) i have found  
> is to use explicit join and contains_eager:
>
> session.query(Child)\
>        .with_lockmode("update")\
>        .join("parent") \
>        .options(contains_eager("parent"))
>
> but it's doesn't look intuitively.
>
> So, do i miss something or eagerload should produce inner join for  
> many-to-one relationship and if so, is there a chance to be fixed?


the behavior we want to eventually implement is to use JOIN instead of  
OUTER JOIN if all foreign key columns in the join condition are not  
nullable.  If the foreign key is nullable, then OUTER JOIN must be  
used for eager loading regardless of many-to-one one-to-many.   If  
your case is the latter then you might need to stick with the explicit  
approach.


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