Python DB API - commit() v. execute("commit transaction")?

Jon Ribbens jon+usenet at unequivocal.eu
Wed May 31 10:58:49 EDT 2017


On 2017-05-31, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> On Wed, May 31, 2017 at 4:26 AM, Jon Ribbens <jon+usenet at unequivocal.eu> wrote:
>> Baloney yourself - I didn't say it was a *new* connection. In DB-API,
>> a Connection is basically nothing - you can do nothing at all with it.
>> A Cursor is actually what any other language would call a connection.
>> If you say that this description is confusing connections and cursors,
>> then you have understood my point - that's exactly what DB-API is doing.
>
> I don't understand what you mean by "connection", then. You seem to be
> defining it as "something that executes queries".

That's what everyone else in the world except Python DB-API appears to
define it to mean, yes.

> I would instead define it as "something responsible for managing the
> low-level state of communication with the database server". There's
> no particular reason why that should include the higher-level
> concept of managing query execution. APIs that do this are just
> conflating concepts in a different way.

A "different" way that is much better and doesn't involve redefining
core SQL concepts to mean things that nobody else uses them to mean.

> I tend to think of DB-API cursors as being more analogous with DBI
> (Perl) or ODBC statement handles.

They're not, they're analogous with the DBI connection and DBI
statement handle being merged into one concept, with the DB-API
"connection" having no analogy as it serves no purpose and is not
used by any other database API.



More information about the Python-list mailing list