a question about mysqldb

Carsten Haese carsten.haese at gmail.com
Thu Aug 14 22:01:23 CEST 2008


Eric Wertman wrote:
> This means I could use this type of syntax?
> 
> sql = 'SELECT (date,time,name,size,count,stuff,flavor) FROM crazyTable
> where monster=:1 and feet=:2 and price=:3'
> 
> cursor.execute(sql,('cookie','3',77.44))
> 
> ?

That depends on which database and DB-API module you're using. Numeric 
parameter style definitely works with sqlite and InformixDB, and I think 
it works with cx_Oracle and mxODBC. Last I checked, it didn't work with 
any PostgreSQL module nor with MySQLdb, but I haven't checked recently 
enough to state categorically that it doesn't work.

For a definitive answer, check the documentation for the DB-API module 
you're using.

--
Carsten Haese
http://informixdb.sourceforge.net



More information about the Python-list mailing list