[DB-SIG] When must transactions begin?
Randall Nortman
rnpydbsig at wonderclown.net
Mon Sep 20 18:03:57 CEST 2010
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. 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?
TIA,
Randall Nortman
More information about the DB-SIG
mailing list