On Feb 12, 2009, at 12:09 PM, Chris Withers wrote:
> > session = sessionmaker(bind=engine)() > unit = Unit(id=1,name='unit 1') > session.merge(unit) > session.add(Record( > timestamp = datetime.now(), > unit = unit, > )) > session.merge(Unit(id=2,name='unit 2')) > > ...barfs on the second session.merge with an eexception that ends as > follows: you're placing "Unit" with a pre-established primary key of "1" in the session twice. merge() only copies state, not the actual object, and returns the newly added or loaded object as its return value. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---