[DB-SIG] autocommit support in pep-249

Vernon Cole vernondcole at gmail.com
Tue Sep 13 17:04:08 CEST 2011


> Properties are just the right tools for this
> task, and appear to be the most used solution in popular drivers.
>
I think that term "attributes" is more commonly used, rather than
"properties", but I agree completely.
"conn.autocommit = True" seems pythonic, as does "if not
conn.autocommit".   Getters and Setters feel like java. The
implementing programmer has getattr and setattr for exactly that
purpose, and the calling programmer has a clean interface.

> The behaviour of setting autocommit when a transaction is already open
> is also to be seen: there are three basic option:
>
> - have a commit
> - have a rollback
> - have an error
>
> I feel the implicit commit is the most dangerous option. An implicit
> rollback may be more acceptable (it's the same behaviour of closing
> the connection with a transaction in progress): I proposed it for
> psycopg but, in the discussion, raising an exception proved the most
> popular option.
>
I don't think I know how to even determine whether there is a
transaction in progress in ADO.(*)  If there is a way, then checking
on it just so that I can raise an exception seems expensive.  Remember
that most of the time the resulting stack trace would not be seen by
the programmer who goofed up, but a completely innocent user -- and to
her it looks like the program just crashed for no reason.  The
rollback would be easy to program and user friendly.  I vote rollback.
--
Vernon

(*) Most of you are dealing with only one underlying database, so have
only that to worry about.  I have to worry about all of your databases
(with the exception of sqlite) and tons of others which neither of us
has ever heard of.  The impression that Microsoft "Active Data
Objects" applies only to Microsoft SQL server databases is very wrong.
There are ODBC drivers for almost everything and ADO providers for
most of the rest. My user may be accessing anything from a .csv text
file to an Active Directory user list. I prefer simple, thank you.


More information about the DB-SIG mailing list