[DB-SIG] paramstyles (mysql string length?)

M.-A. Lemburg mal at egenix.com
Wed Apr 19 14:24:10 CEST 2006

Andy Todd wrote:
> Once more, %s is simply a marker in the statement you provide to the 
> execute method which says "substitute the next item from the tuple I've 
> provided here please". It is not string substitution.
> Now hands up for changing the DB-API to remove the pyformat paramstyle? 
> If we're going to have options I think we should restrict them to either 
> named parameters (a la cx_Oracle) or the '?' qmark (a la ODBC and JDBC).

Since this sort of confusion comes up again and again, I'm +1 on
removing 'pyformat' and 'format' in the next version of the DB-API
(and maybe marking it for deprecation in PEP 249 now).

I've found the qmark style to be sufficient for everything, but
then, I'm biased. For the few cases where binding variables
are not allowed in SQL (e.g. table names), I use standard Python
string formatting. Even then, things look very straight forward
in the code: %s is a Python formatting marker, ? is a bound

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Apr 19 2006)
>>> 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 mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::

More information about the DB-SIG mailing list