[DB-SIG] When must transactions begin?
M.-A. Lemburg
mal at egenix.com
Mon Sep 20 18:49:29 CEST 2010
Randall Nortman wrote:
> PEP 249 says that transactions end on commit() or rollback(), but it
> doesn't explicitly state when transactions should begin, and there is
> no begin() method.
Transactions start implicitly after you connect and after you call
.commit() or .rollback(). They are not started for each statement.
> I think the implication is that transactions begin
> on the first execute(), but that's not explicitly stated. At least
> one driver, pysqlite2/sqlite3, does not start a transaction for a
> SELECT statement. It waits for a DML statement (INSERT, UPDATE,
> DELETE) before opening a transaction. Other drivers open transactions
> on any statement, including SELECT.
>
> My question for the DB-SIG is: Can I call it a bug in pysqlite2 that
> it does not open transactions on SELECT? Should the spec be amended
> to make this explicit? Or are both behaviors acceptable, in which
> case perhaps a begin() method needs to be added for when the user
> wants control over opening transactions?
I should probably add a note to PEP 249 about this.
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, Sep 20 2010)
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
::: Try our new mxODBC.Connect Python Database Interface for free ! ::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
http://www.egenix.com/company/contact/
More information about the DB-SIG
mailing list