the left outer join means there is a lazy=False or lazy='joinedload' on the 
relationship, or in this case since its sporadic, the parent Invoice is likely 
being loaded with an option like joinedload(Product.vat).    The options 
specified in Query get attached to lazy loaders later in the chain, if the 
given joinedload() chain doesn't start from the entity being queried (which is 
probably the case if the query uses joinedload() and not joinedload_all()).   
For those Product objects already in the identity map, this option would not 
take place.


On Mar 7, 2011, at 8:13 AM, Joril wrote:

> Hi everyone!
> 
> I have an object graph like this:
> 
> Invoice -> Detail (one-to-many with cascade) -> Product (many-to-one) -
>> VAT (many-to-one)
> 
> My problem is that sometimes if I have a Detail and try to read its
> Product, the triggered lazy-loading generates a query more complicated
> than necessary, having a LEFT OUTER JOIN on the VAT table too... Other
> times the lazy-loading query joins only Detail and Product.
> I think I'm doing something fishy here.. What could I check, to ensure
> that the lazy loading doesn't touch unneeded entities?
> 
> Many thanks!
> 
> (SQLAlchemy 0.6.6, PGSQL 8.3)
> 
> -- 
> 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.

Reply via email to