MySQLdb UPDATE does nothing
David Wilson
dw-google.com at botanicus.net
Thu Sep 15 08:08:22 EDT 2005
>> sql="UPDATE product_attribute SET index_column = "+str(index)+" WHERE id = "+str(record2[0])
>> ..
>> cursor.execute(sql)
To allow the DB-API adaptor to correctly take care of value conversion
and SQL escaping for you, this should be written as:
cursor.execute("UPDATE product_attribute SET col1 = %s WHERE id = %s",
(index, record2[0]))
As for why the UPDATE has no effect, which version of MySQL are you
using?
David.
More information about the Python-list
mailing list