Hello, I need to save data multiple times in a for loop. I was trying to do something like this:
You are able to select which group you want to be in: A,B,C,D.... for record in userchoice: new=model.User() #set some variables if record.group=='A': #set some more fields new.save() new.flush() elif record.group=='B': #set some more fields new.save() new.flush() If I do that I get: File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/mapper.py", line 838, in save_obj raise exceptions.FlushError("New instance %s with identity key %s conflicts with persistent instance %s" % (mapperutil.instance_str(obj), str(instance_key), mapperutil.instance_str(existing))) FlushError: New instance [EMAIL PROTECTED] with identity key (<class 'XXX.model.User'>, (19527, None), None) conflicts with persistent instance [EMAIL PROTECTED] Is there a way to do multiple inserts with sqlalchemy? Lucas -- -- Vim auto completion for python http://lucasmanual.com/mywiki/FrontPage#head-8ce19b13e89893059e126b719bebe4ee32fe103c TurboGears from start to finish: http://www.lucasmanual.com/mywiki/TurboGears --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---