[DB-SIG] Improved support for prepared SQL statements

M.-A. Lemburg mal at egenix.com
Wed Dec 17 16:03:09 CET 2014

On 17.12.2014 15:38, SF Markus Elfring wrote:
>>> Can the prepare() method return a handle for a SQL statement?
>> The proposal says:
>> """
>> Return values are not defined.
>> """
> How do you think about to change the application programming
> interface here?
> Would a class like "prepared_statement" be more useful at this place?

The DB-API tries to make higher level abstractions possible,
but doesn't mandate any of them in order to make writing
database modules easier and to get more database backends

I think you're looking for SQLAlchemy or SQLObject :-)

>>> Will prepared SQL statements be mapped to a specific class hierarchy
>>> in Python?
>> Not sure what you mean.
> The structured query language supports a few standard statements like
> insert, update and delete. I imagine that specific classes will be
> useful for their parameterisation, won't they?

Please see above.

>>>> It is possible to open a few cursors, prepare frequently
>>>> used statements on them and them make them accessible via
>>>> a cursor pool. This works well (I know since I've implemented
>>>> such a logic some 14-15 years ago in a large application).
>>> How should the application programming interface look like
>>> in Python for this use case?
>> Depends on the application and what you want to achieve.
>> There's no general answer to this.
> I find that view strange.
> I would appreciate if the corresponding software abstractions
> can be improved in reasonable ways.

Please explain what you want in more detail, so we can check
whether there's room for improvement :-)

Note that the DB-API doesn't require implementing connection
or cursor pools. It only provides ways of making these possible
at higher abstraction levels.

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Dec 17 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