> > IIRC, the implementation of the two phase commit basically has everyone > flush on Phase1, then report back as a "vote". If there are any negative > votes, the transaction manager instructs everyone to fail and rollback as > Phase2. If you had a flush that caused an integrity error before trying > to commit, that would still trigger an issue. >
``session.flush()`` is called during tpc_begin, a hook which is called before the two phase commit proper. If an integrity error is raised then it should be treated the same as it would earlier in the transaction, resulting in the transaction being aborted. I don't think it's strictly necessary, though it does serve to reduce the time spent performing the two phase commit. So long as you configure your session to use two phase commit, zope.sqlalchemy will call ``tx.prepare()`` during tpc_vote and ``tx.commit()`` during tpc_finish. If you're only using sqlalchemy then doing it all with the Session is perfectly possible, though the transaction / request integration that comes with using zope.transaction and pyramid_tm is very handy. Laurence -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.