[DB-SIG] paramstyle without knowing the database

M.-A. Lemburg mal at egenix.com
Mon Dec 3 09:57:03 CET 2012

On 03.12.2012 09:31, wilk wrote:
> Hi,
> I did a litle function to use the same paramstyle regardless of the 
> paramstyle of the database. I transform one paramstyle to an other (a 
> code missing in the lib standard isn't it ?)

There are a few such libraries out there which take care of
such conversions. The standard itself cannot provide an example

> But of course i need to know the paramstyle of the database. I didn't 
> found any way to retrieve it from the connexion. Did i missed 
> something ?

No, the standard only defines a per module global for the

We might want to extend this to connections and cursors
as well in DB APi 3.0, to make it easier to write such conversion
routines, and then perhaps also make those attributes writable,
so that the paramstyle can be adjusted on a per connection and
cursor basis.

> Is there a project to have one paramstyle mandatory for all the 
> database ? I'm afraid that because there is not people will not use it 
> at all and use manual string escape wich is a big security hole (i've 
> seen that from people comming from php).

For DB-API 3.0 there's a proposal to make support for the two
paramstyles 'named' and 'qmark' mandatory (but leave all existing
styles in the standard), or reduce the number of standard
paramstyles to these two.

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Dec 03 2012)
>>> Python Projects, Consulting and Support ...   http://www.egenix.com/
>>> mxODBC.Zope/Plone.Database.Adapter ...       http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
2012-11-28: Released eGenix mx Base 3.2.5 ...     http://egenix.com/go36
2013-01-22: Python Meeting Duesseldorf ...                 50 days to go

::: Try our new 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