executemany & UPDATE (MySQL & Python)

Nick Arnett narnett at mccmedia.com
Fri Jun 14 12:15:49 EDT 2002


Can anyone confirm that it is *not* possible to pass a list to the Python
MySQLdb module in UPDATE operations?  In other words, this kind of thing
works:

self.dbh.execute("INSERT INTO Foo (blah, blorg,snork) VALUES
(%s,%s,%s)",myList)

... But this kind doesn't appear to work for me:

self.dbh.execute("UPDATE Foo SET blah=%s, blorg=%s WHERE snork=%s",myList)

Doing the latter with a loop in Python is much slower than I'd expect that
doing it with a list would be.

Nick

--
narnett at mccmedia.com
(408) 904-7198






More information about the Python-list mailing list