TypeError:execute()得到了一个意外的关键字参数' multi'

时间:2016-02-08 22:29:20

标签: python-3.x mysql-python

我正在尝试使用MySQLdb模块删除数据库中的记录。 在https://dev.mysql.com/doc/connector-python/en/connector-python-api-mysqlcursor-execute.html中,我发现multi = True表示在执行中执行多个quires但它会产生错误。有人能帮助我知道我所缺少的东西吗?

query = "DELETE FROM Service_Machine WHERE Id=(SELECT Id FROM Machines WHERE Id="+id+");" \
        "DELETE FROM Machine_Usage WHERE Id=(SELECT Id FROM Machines WHERE Id="+id+");" \
                    "DELETE FROM Machines WHERE Id="+id+");"
print(query)
self.cursor.execute(query, multi=True)

0 个答案:

没有答案