This project is archived and is in readonly mode.

#89 ✓invalid
Samuel PHAN

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

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

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

Comments and changes to this ticket

  • Daniele Varrazzo

    Daniele Varrazzo January 10th, 2012 @ 08:23 PM

    • 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.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

<b>WARNING:</b> the informations in this tracker are archived. Please submit new tickets or comments to <a href="https://github.com/psycopg/psycopg2/issues">the new tracker</a>.
<br/>
Psycopg is the most used PostgreSQL adapter for the Python programming language. At the core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.

Shared Ticket Bins

Pages