On Mar 29, 2009, at 11:00 PM, iain duncan wrote:
> > Hi Mike, I tried out the merging, but am hitting the snag that objects > referred to in relations are now going into the db twice. Ie > > class MySeedData(SeedData): > van = Region(name="Vancouver") > event_1 = Event(name="Event 1", region=van) > > is putting the Region in twice. OK, in that case the Region object you create would need to have a primary key already expressed before you put it in, otherwise SQLA thinks its a new Region being merged. so maybe merge is cumbersome here. > I also tried out the instance clearing tip. I'm on sa 0.4.8, but there > is no orm.attributes.instance_key. the method in 0.5 is "instance_state". in 0.4.8, I think you can just say del myobject._instance_key and it will become an INSERT again. keep in mind the object will insert itself with the same primary key as it was originally assigned with the first insert. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---