[DB-SIG] trouble with list formatting

Dieter Maurer dieter at handshake.de
Tue Jun 5 19:21:05 CEST 2007


Roger Doger wrote at 2007-6-4 09:46 -0500:
>The following use of the API with MySQL works fine
>
>> items = [1, 2]
>> execute('SELECT * from table1 WHERE field1 IN %s', (items,))
>resultant query string: SELECT * from table1 WHERE field1 IN ('1', '2')
>
>By contrast, the following yields the message "error in your SQL syntax"
>
>> items = [1]
>> execute('SELECT * from table1 WHERE field1 IN %s', (items,))
>resulting query string: SELECT * from table1 WHERE field1 IN ('1',)

A bug in your Python-database bridge. It should handle sequences correctly.



-- 
Dieter


More information about the DB-SIG mailing list