On Oct 23, 2007, at 1:07 PM, Lukasz Szybalski wrote:

>
> So you cannot do multiple writes using extensions assign_mapper,
> mapper aka python class mapped to sql table?

you can do anything with assign_mapper, just that its usage is going  
to be more confusing since it auto-saves objects, and calling flush()  
for a single object is also error prone.  for this reason  
assign_mapper is deprecated in version 0.4.

>
> What I should use then is
> user_table = sqlalchemy.Table('Users', metadata, autoload=True)
> new=users_table.insert()
>
>
> and new.execute(somedictionary,somedictionary2)
> or
> new.execute(somedictionary)
> #change somedictionary
> new.execute(somedictionary)

if youd like to save multiple objects with the ORM:

for rec in collection:
        x = MyObject(rec)
        sess.save(x)

sess.flush()

the error you got specifically indicates you created two objects with  
the same primary key attributes, in your case they both had (19527,  
None) for their composite primary key values.






--~--~---------~--~----~------------~-------~--~----~
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