[DB-SIG] Improved support for prepared SQL statements

M.-A. Lemburg mal at egenix.com
Thu Dec 18 21:56:27 CET 2014

On 18.12.2014 21:23, Michael Bayer wrote:
> Basically I want there to be very good reason for this feature to be an explicit part of the DBAPI because it is going to give me personally a lot of extra headaches when people start asking for it in the name of “performance”, especially since that in practice, psycopg2,  pg8000 and perhaps mxODBC will be the only DBAPIs to add this feature, the MySQL DBAPIs are unlikely to be interested in this, and the pysqlite API almost certainly won’t as they have been stalling for years just on very rudimental transactional issues that remain open.   A DBAPI can already choose to make use of cached prepared statements as an internal optimization, using an LRU cache that could be configurable via the connect() function, or just via the executemany() API as some do right now.   

We are discussing a standard extension to the DB-API, not a mandatory

The point of the discussion is to come up with a design that the
database authors, who want to implement this or have already implemented
it, can use the same semantics for the extension.

As mentioned in my other reply, caching or reusing prepared cursors
is not necessarily the main reason for having a .prepare() method.

You can have prepared cursors without this method by running
the queries on a cursor and then caching the used cursors for
reuse in a pool.

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Dec 18 2014)
>>> Python Projects, Coaching and Consulting ...  http://www.egenix.com/
>>> mxODBC Plone/Zope Database Adapter ...       http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
2014-12-11: Released mxODBC Plone/Zope DA 2.2.0   http://egenix.com/go67

::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611

More information about the DB-SIG mailing list