I never did understand the pros or cons of running autocommit=True,
aside from this flushing issue. Are there performance implications ?

On Mon, Feb 7, 2011 at 1:22 PM, Michael Bayer <mike...@zzzcomputing.com> wrote:
> I actually just did a little bit of reverse course on this in 0.7.   I've 
> moved all the accounting into the try/except block so that the flush 
> completes fully before the autocommit expires everything.   This is a change 
> to a pattern that's been the same way since 0.4 so hoping nothing bad happens 
> when we put 0.7 out into betas.
>
>
> On Feb 7, 2011, at 2:52 PM, Romy Maxwell wrote:
>
>> Are there any downsides to setting expire_on_commit=False when using
>> autocommit=True ? In other words, should I expect to see stale data or
>> other side effects ?
>>
>> On Mon, Feb 7, 2011 at 8:30 AM, Michael Bayer <mike...@zzzcomputing.com> 
>> wrote:
>>>
>>> On Feb 7, 2011, at 7:42 AM, Romy Maxwell wrote:
>>>
>>>> Hey Michael,
>>>>
>>>> I didn't wanna revive a really old thread
>>>> [http://www.mail-archive.com/sqlalchemy@googlegroups.com/msg16598.html],
>>>> so I figured maybe you won't mind the email.
>>>>
>>>> I don't understand why, in the thread, using autocommit=True makes the
>>>> object unreachable, or what that actually means. I'm assuming it was
>>>> referring to the latter part of the code:
>>>>
>>>>> o = s.query(T).get(2)
>>>>> o.id = 10
>>>>> o.description = "Changed"
>>>>> s.flush()
>>>>
>>>> With autocommit=True, I've always thought flushes created their own
>>>> transactions, like so:
>>>>
>>>> s.begin()
>>>> s.flush()
>>>> s.commit()
>>>>
>>>> But if that was true, then the commit happens after the flush. How
>>>> would the commit expire anything and/or make anything unreachable for
>>>> the flush ?
>>>
>>>
>>> The commit is expiring because that's what it does when expire_on_commit is 
>>> True.    So the flush goes into its post-commit accounting, it in fact has 
>>> to reload all the objects, one at a time, so is hugely inefficient and I'm 
>>> going to add a big warning for that in 0.7, ticket 2041.
>>>
>>>
>>>
>
>

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