On Sep 6, 2010, at 9:06 AM, Kent wrote:

> with_parent seems to add a join condition.  

OK, so I guess you read the docs which is why you thought it joined and why you 
didn't realize it doesn't work for transient.  r20b6ce05f194 changes all that 
so that with_parent() accepts transient objects and will do the "look at the 
attributes" thing.   The docs are updated as this method does use the lazy 
loader SQL mechanism, not a join.



> Is there a way to get at
> the query object that would be rendered from a lazy load (or what
> "subqueryload" would render on the subsequent load), but on a
> transient object, if i supply the session?
> 
> even though not "recommended", can it make sqla believe my transient
> object is detached by setting its state key?
> 
> There are reasons i do not want to add this to the session and
> disabling autoflush would also cause problems.
> 
> 
> 
> On Sep 3, 9:58 am, Michael Bayer <mike...@zzzcomputing.com> wrote:
>> On Sep 3, 2010, at 9:36 AM, Kent wrote:
>> 
>>> For the case of customerid = '7', that is a simple problem, but when
>>> it is a more complex join condition, we only wanted to define this
>>> condition in one single place in our application (namely, the orm).
>>> That way, if or when that changes, developers don't need to search for
>>> other places in the app that needed to manually duplicate the logic of
>>> the orm join condition.
>> 
>>> If I supplied the DBSession to sqla, it would know how to create the
>>> proper Query object for this lazyload.  Can you point me in the right
>>> direction (even if where you point me is not currently part of the
>>> public API)?
>> 
>> Query has the with_parent() method for this use case.  
>> 
>> 
>> 
>> 
>> 
>>> Thanks again,
>>> Kent
>> 
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "sqlalchemy" group.
>>> To post to this group, send email to sqlalch...@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> sqlalchemy+unsubscr...@googlegroups.com.
>>> For more options, visit this group 
>>> athttp://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 sqlalch...@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 sqlalch...@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