On Dec 17, 2008, at 8:18 AM, Max Ischenko wrote:

>
> Hello,
>
> I'm having trouble doing insertmany correctly. I read the docs and
> came up with this code:
>
>        s = Session()
>        ins = data_tbl.insert()
>        records = []
>        for rec in s.execute(sql).fetchall():
>            records.append(rec)
>        ins.execute(records)

im not entirely sure of the mechanics there but try:

records.append(dict(rec))

if still no go, make sure "records" is coming up as a list of dicts,  
and each item in the dict is of the appropriate key/value to work as a  
value for your insert statement.

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

Reply via email to