[DB-SIG] Improved support for prepared SQL statements

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


On 17.12.2014 16:18, SF Markus Elfring wrote:
>> Please explain what you want in more detail, so we can check
>> whether there's room for improvement :-)
> 
> Can the SQL update statement be encapsulated by a dedicated Python
> class for example?

Sure. You could write a class that only supports update statements
and has methods for running/customizing them. This could then use
the DB-API to talk to the database, abstracting away the details
you don't want to deal with in the application.

Another possibility is to write a layer on top of the DB-API
to abstract the underlying queries away from the application
and only have the layer provide dedicated methods for the
things the application needs, such as query method for specific
details or inserting application objects into the database.

This is the approach we usually take in our projects, since
it provides better separation of the application logic from the
database logic than using ORMs usually provides. It's also possible
to use such an abstraction layer on top of an ORM, if you want
to the ORM to deal with abstracting away database backend details.

>> 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.
> 
> I am looking for higher service levels without following the software
> design directions from object-relational managers like SQLAlchemy
> and SQLObject.

There were a few attempts in that direction:

https://wiki.python.org/moin/HigherLevelDatabaseProgramming

but most of them are no longer available.

-- 
Marc-Andre Lemburg
eGenix.com

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
               http://www.egenix.com/company/contact/


More information about the DB-SIG mailing list