On Apr 8, 2008, at 6:56 PM, Rick Morrison wrote:

> Is there a reason that lazy loaders for a 1->many relationship with  
> an underlying FK column value of NULL still try to load instances  
> with a query when an access is made to the mapped attribute? You  
> know it's going to be an empty collection, right?


the lazy loader is not supposed to fire off unless the instance has an  
_instance_key on it (and therefore has a primary key).    So theres a  
little bit of an assumption that the collection is keyed off the  
primary key of the parent instance (with 1->many the FK is on the  
remote table so I assume thats what you meant).   I guess thats not  
the case with your test case, so lazy_clause() could be enhanced to  
return None if no binds get a value (theres some other mechanics  
regarding deferred loading of attributes in that function which  
LoadLazyAttribute could send in a flag to disable).

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