我已将新列添加到现有mysql表中,默认值为' 0'。 我试图将这些值更新为' 1'使用python脚本,但它对表没有任何影响。
在日志上
SELECT * FROM `customer_1`.`violations` WHERE 0=1
这是我的python脚本:
#!/usr/bin/env python
import os, sys
from mydb import cursor
from twisted.enterprise import util as dbutil
from MySQLdb import escape_string
sql ="UPDATE `customer_1`.`violations` SET `flag`='1' WHERE `flag`='0' ";
print sql
cursor.execute(sql)
当我在mysql上运行相同的语句时,它会起作用。
谢谢
答案 0 :(得分:1)
执行声明后你不需要提交吗?
cursor.commit()