On Nov 4, 2010, at 4:38 PM, Mike Bernson wrote: > I have a transaction started with begin > I then delete a record in the transaction. > I then commit and the commit fails. > I now want to continue by undelete the record but leave > record in the session. > > I want to leave the record in the session because session > is doing caching. > > The session is created by: > self.session = Session(bind=engine, autoflush=False, > _enable_transaction_accounting=False, autocommit=True, > query_cls=my_query, weak_identity_map=True)
So, you're using that flag I created just for you, _enable_tranaction_accounting. If you didn't use that, the rollback() operation would restore all items that were marked as "deleted" back to the persistent state. Their attributes would be expired, however. Its not possible for attributes to "roll back" to their previous value from memory without a vast amount of additional complexity (and I mean vast, it's been considered). > > -- > 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. > -- 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.
