I am getting a TypeError when using the executemany() method of the db cursor.

I'm not sure if this is a problem with psycopg2 or the DB backend in
Django. I am using the psycopg2_postgresql backend directly via the
django.db.connection.

This is the code which I am trying to get working:
def save_fieldmap(mapping):
    cursor = connection.cursor()
    cursor.executemany("""INSERT INTO emma_import_history_fieldmap

(emma_import_history_id,emma_import_history_field_name,emma_import_history_column_num)
                          VALUES
(%(history_id)d,%(field_name)s,%(column_num)d);""", mapping)

However, when I do that, I get a TypeError (int argument required) on
line 30 of django/db/backends/util.py. I put that function on dpaste:
http://dpaste.com/37751/

The list of dictionaries I am passing in "mapping" looks like this:
[{'column_num': 1, 'field_name': u'member_name_first', 'history_id':
123635}, {'column_num': 0, 'field_name': u'member_email',
'history_id': 123635}, {'column_num': 2, 'field_name':
u'member_name_last', 'history_id': 123635}]

I have tried many different ways of using a list of lists to pass as
the params to executemany, but everything I seem to try ends up giving
me this TypeError. As I said, the issue may lie in psycopg2, but I
thought I would ask here as I've been fighting this for 3 days.

Thanks,
Alex

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to