[DB-SIG] what is the "correct" way to alter paramstyle in a PEP 249 interface?

M.-A. Lemburg mal at egenix.com
Sat Sep 26 11:16:01 CEST 2009


Vernon Cole wrote:
> I am planning to add, as an extension, the ability for adodbapi to change
> its paramstyle.  I personally like "named" much better than "qmark", and it
> happens that django expects to have "format", so I will add that, too.
> 
> My question is, what would be an appropriate way to specify the altered
> paramstyle?
> 
> 1) As an attribute of the connection:
>     con = adodbapi.connect('spam eggs")
>     con.paramstyle = "named"

Most other configuration parameters are made available on
connections and cursors (with the cursor setting overriding the
connection one), so I think that's the most DB-API
compatible way of implementing this.

> 2) Make the module global mutable:
>    adodbapi.adodbapi.paramstyle = "named"  # [ ick! ]
> 
> 3) As a named parameter of the connection:
>   con = adodbapi.connect("spam eggs", paramstyle="named")
> 
> Has anyone else done this?
> How did they do it?
> How will some speculated future db-api version 3.0 want it?

Probably in the way you mentioned above.

The module global would then provide to the default setting.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Sep 26 2009)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

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


More information about the DB-SIG mailing list