importMySQLdbconn=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')})printcursor._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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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