On Jan 9, 2012, at 2:30 PM, Kent wrote:

>> i guess the patch is interacting with that "load_on_pending" stuff, which I 
>> probably added for you also.  It would be nice to really work up a "new 
>> SQLAlchemy feature: detached/transientobject loading" document that really 
>> describes what it is we're trying to do here.    If you were to write such a 
>> document, what example would you give as the rationale ?    I know that's 
>> the hard part here, but this is often very valuable, to look at your 
>> internal system and genericize it into something universally desirable.
> 
> As far as such a document, would you want a trac ticket opened with my
> use case in a generalized form where others may likely have the same
> use case?
> 
> Hoping to not upset you here.....:
> 
> My "AttributeImpl.callable_" hack to set a transient state's
> session_id, load the relationship, and then set it back to None works
> for m2o but when it needs to load a collection (or it can't use get()
> I presume), then I am hitting this "return None":
> 
> class LazyLoader(AbstractRelationshipLoader):
>    def _load_for_state(self, state, passive):
>        ...
>        ...
>        lazy_clause = strategy.lazy_clause(state)
> 
>        if pending:
>            bind_values = sql_util.bind_values(lazy_clause)
>            if None in bind_values:
>                return None    ###  <================
> 
>        q = q.filter(lazy_clause)

that means some of the columns being linked to the foreign keys on the target 
are None.  If you want your lazyload to work all the attributes need to be 
populated.   If you're hitting the "get committed " thing, and the attributes 
are only pending, then that's what that is.


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