Thanks, that was it. On Jun 25, 5:25 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Jun 25, 2007, at 4:09 AM, mc wrote: > > > > > > > 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 > > ensure you are using InnoDB tables if youre using MySQL.
--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---