I have the following piece of code: transaction = session.create_transaction() try: # Do some work here that might fail p=P() p.ID=333 session.save(p) session.flush() # Do some more work here that might fail p1=P() p1.ID=333 session.save(p1) session.flush() # Success, commit everything transaction.commit() except: # Make sure the transaction is rolled back ... transaction.rollback() # ... then propagate the error upwards to be handled elsewhere raise
The 2nd flush fails (because there is already an ID - 333) and then rollback is called, but the first row entered remains in the database. Wasn't rollback supposed to remove it? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---