Re: [sqlalchemy] Re: SQLAlchemy + Elixir + Tornado overall setup

2011-02-14 Thread Romy Maxwell
Thanks Michael.

On Fri, Feb 11, 2011 at 1:44 PM, Michael Bayer wrote:

>
> On Feb 11, 2011, at 3:05 PM, Romy wrote:
>
> > On Feb 11, 9:13 am, Michael Bayer  wrote:
> >> autocommit=True means every SELECT statement as well as every flush()
> uses its own transaction, that begins as the method is called, and is
> immediately closed, within the scope of the method call on your end.
> begin() *only* works when autocommit=True, and only affects the way
> SQLAlchemy pulls connections from the connection pool.DBAPI has no
> "begin", the connection itself is always in a transaction as soon as
> statements are emitted, unless commit() or rollback() is called.
> >
> > In the entire time I've been running autocommit=True (on myISAM), I've
> > never seen SELECTs get their own transaction in the log output, while
> > every UPDATE/INSERT does. Is there something wrong w/ the log output ?
>
> again, as far as the DBAPI is concerned, everything is "in a transaction",
> the myISAM tables just ignore it.The COMMIT is emitted by SQLalchemy if
> the statement within the autocommit execution was a DML (CRUD) statement.
>  See
> http://www.sqlalchemy.org/docs/core/connections.html#understanding-autocommit(I'd
>  recommend reading the whole page as well as
> http://www.sqlalchemy.org/docs/orm/session.html)
>
>
> >
> > --
> > 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.
> >
>
> --
> 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.
>
>

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



Re: [sqlalchemy] Re: Strange ObjectDeletedError

2011-02-09 Thread Romy Maxwell
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  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  
>> 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.