On Apr 18, 2007, at 8:29 AM, [EMAIL PROTECTED] wrote:
> > # Read from one data base > engine = create_engine('sqlite:///Simple.db') > metadata.connect(engine) > session = create_session(bind_to=engine) > objects = session.query(Simple).select() the objects are persistent (i.e. are represented in the database, and are present in the session). > # My feeble attempt to divorce the objects from the session > for obj in objects: > session.expunge(obj) > session.close() > the objects are detached (i.e. are represented in the database, and are not present in a session). each instance has an "_instance_key" attribute which is a marker that they are "from the database". > # Connect the objects to the "write" session > for obj in objects: > session.save(obj) the objects are detached...oh wait, lets see what SA says: "Instance'Simple(u'They')' is a detached instance or is already persistent in a differentSession"...yup, its the first part of that, detached ! which means either: session.update(obj) or session.save_or_update(obj) will put the object into a new session. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---