executemany fails when passing a list of dicts

Bug #712137 reported by Mattias Lundell
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mysqldb (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: python-mysqldb

using the table:
--------------------
create table a(f1 int, f2 int);

and the python code:
---------------------------

import MySQLdb

conn = MySQLdb.connect('localhost','root','root','test')
cursor = conn.cursor()

vals = [{'f1' : 1, 'f2' : 2}]
sql = "insert into a values (%(f1)s, %(f2)s)"

print MySQLdb.__version__
cursor.execute(sql, vals[0])
print "execute works"
cursor.executemany(sql, vals)
print "execute many works"

gives the result:
--------------------

1.2.2
execute works
Traceback (most recent call last):
  File "test.py", line 11, in <module>
    cursor.executemany(sql, vals)
  File "/usr/lib/pymodules/python2.6/MySQLdb/cursors.py", line 217, in executemany
    self.errorhandler(self, exc, value)
  File "/usr/lib/pymodules/python2.6/MySQLdb/connections.py", line 35, in defaulterrorhandler
    raise errorclass, errorvalue
ValueError: incomplete format

but should give:
--------------------

1.2.2
execute works
execute many works

Revision history for this message
dino99 (9d9) wrote :

This version has expired

Changed in python-mysqldb (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.