import PySQLPool
connection = PySQLPool.getNewConnection(username='root', password='123456', host='localhost', db='mydb')
query = PySQLPool.getNewQuery(connection)
如何使用此查询批量执行更新?
update info set info="ichi" where msisdn1=XXX and msisdn2=yyyy
update info set info="ni" where msisdn1=XXX and msisdn2=PPP
答案 0 :(得分:0)
经过一番奋斗并研究PySQLPool。我找到了这个。
sample =""" UPDATE userscore SET info ="%s"在哪里msisdn1 =%s和msisdn2 =%s""" data = [(' ichi',911234123412,16502522222),(' ni',911234123412,16502326969),(' san',911234123412,919999683)]
来源:http://dev.mysql.com/doc/connector-python/en/connector-python-api-mysqlcursor-executemany.html