diff --git a/MySQLdb/cursors.py b/MySQLdb/cursors.py index 9797d4a4..7c018708 100644 --- a/MySQLdb/cursors.py +++ b/MySQLdb/cursors.py @@ -240,7 +240,13 @@ def executemany(self, query, args): e = m.end(1) qv = m.group(1) try: - q = [ qv % db.literal(a) for a in args ] + q = [] + for a in args: + if isinstance(a, dict): + q.append(qv % dict((key, db.literal(item)) + for key, item in a.iteritems())) + else: + q.append(qv % tuple([db.literal(item) for item in a])) except TypeError, msg: if msg.args[0] in ("not enough arguments for format string", "not all arguments converted"):