Jon Nelson <jnel...@jamponi.net> wrote:

> On Fri, Jan 9, 2015 at 2:42 PM, Jon Nelson <jnel...@jamponi.net> wrote:
>> On Fri, Jan 9, 2015 at 2:21 PM, Michael Bayer <mike...@zzzcomputing.com> 
>> wrote:
>>> Jon Nelson <jnel...@jamponi.net> wrote:
>>> 
>>>>> so you could use either merge() or merge_result() but to avoid any SQL 
>>>>> set load=False.
>>>> 
>>>> When I tried with load=False, I got an error. I am using 0.9.8.
>>> 
>>> care to be more specific
>> 
>> 
>> Absolutely.
>> 
>> It took me a bit to grab a bite to eat and whip up a quick test example.
>> I hope the following is more useful!
> 
> 
> I Know what it is!
> 
>>        dbsess.query(Foo).filter(Foo.c1.in_(keys)).all()
> ^^^
> 
> If I throw the result out, the session's *weak-reference* on the
> instances may allow them to be garbage collected.
> Hah!
> If I change the above line to:
>         zz = dbsess.query(Foo).filter(Foo.c1.in_(keys)).all()
> and change nothing else, then both the 'merge' and 'merge_result'
> approaches work great!

yeah, holding onto the all() result is pretty key :)


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to