Elephant Liu - 2013-04-24
import MySQLdb

conn = MySQLdb.connect(user='xxx',passwd='xxx',db = 'xxx')

cursor = conn.cursor()

n = cursor.execute(
    'select * from xxx where `content` in %(content)s',
    { 'content': ('aa','bb','cc') }
)
print cursor._last_executed

I hope it print:

select * from xxx where content in ('aa', 'bb', 'cc')

but actually it print:

select * from xxx where content in ("'aa'", "'bb'", "'cc'")

and because of this , the query fetch nothing

Is this a bug of MySQLdb ?

my system:

Ubuntu 12.04.2 LTS

Python 2.7.3

MySQLdb 1.2.3