MySQLdb LIKE '%%%s%%' problem

Peter Otten __peter__ at
Wed Jan 14 11:06:26 CET 2009

gumbah wrote:

> I tried all of your suggestions but none of them work... I have a clue
> on why it is failing: MySQLdb seems to quote the % characters or
> something...
> Even when i do:
> cursor.execute("UPDATE tablename set fieldx='test' WHERE flfieldx is
> null and fieldy like '%therealvalue%' "

> it is not updating the database...
> Maybe I am completely overlooking something, but I am pretty lost
> here... Googling this it seems as if no one is using "LIKE '%value%'"
> type queries with Python & mySQL...
> Anyone any other thoughts?

Did you call the connection object's commit() method?


More information about the Python-list mailing list