Hi, I'm new to this group - here's my question, I've been fighting
with this for a while now....

I need to insert a list of lists into a database. It works using a for
loop but this is very slow so I want to optimize it. The method of
bulk inserting in SQLAlchemy is much faster but only seems to take a
list of dictionaries, so I converted the list of lists to a list of
dictionaries using a list comprehension:

values = [{'name': list[0], 'age': list[1], 'email': list[2]} for list
in list_of_lists] (the real list is alot longer)

Unfortunately I get an 'index out of range' error when this runs.

Is there any way of doing this more simply? When using the Python
DBAPI it is as simple as calling executemany(). It seems odd that
there is not a simple method like that in SQLAlchemy.

Thanks

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

Reply via email to