How to update multiple rows with single MySQL query in python?
#!/usr/bin/python # -*- coding: utf-8 -*- import MySQLdb as mdb con = mdb.connect('localhost', 'root', 'root', 'kuis') with con: cur = con.cursor() cur.execute("UPDATE Writers SET Name = %s WHERE Id = %s ", ("new_value" , "3")) print "Number of rows updated:", cur.rowcount With above code the third row's value of the table Writers in the database kuis gets updated with new_value and the output will be Number od rows updated: 1 How am I supposed to update multiple rows at the same time? Probably you are looking for cursor.executemany . cur.executemany("UPDATE Writers SET Name = %s WHERE Id = %s