Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Feature: add an "execute()" method on the Connection object

#89

Is it a good idea to add an "execute()" method on the Connection object, to avoid calling the "cursor()" and then an "cursor.execute()" method ?

I know it's nonstandard DB-API 2.0 but since the DB-API doesn't impose to have an "execute()" function on the connection, there is no collision in the name.

E.g.: sqlite3 provides an "execute()" method on the connection object.

http://docs.python.org/library/sqlite3.html#sqlite3.Connection.execute

What do you think ?

Samuel

Reported by Samuel PHAN · January 10th, 2012 @ 02:54 PM

State: invalid
Milestone: none
Assigned to: nobody

Activity

  1. Daniele Varrazzo
    Daniele Varrazzo
    • State changed from new to invalid

    No, I don't think it is a good idea: it saves you a single line of code (which is not the design guideline of python systems) at the expense of writing code that will have to be changed if you want to port the program to another database, which is exactly what the dbapi wants to avoid. Psycopg does have dbapi extensions, but they are there to access features not available otherwise within the dbapi interface.

    This is my opinion: feel free to raise the discussion in the mailing list, but I don't expect it to be well accepted. There are plenty of python postgres drivers with their own interface, and all of them have been abandoned.

    January 10th, 2012 @ 08:23 PM