zopefoundation / zope.sqlalchemy

Integration of SQLAlchemy with transaction management
Other
32 stars 34 forks source link

Support nested sqlalchemy transactions #1

Closed aadis closed 10 years ago

aadis commented 11 years ago

Currently the session.begin_nested() and session.commit() pattern does not work.

This allows using subtransactions. In my (limited) testing it seems to work.

aadis commented 10 years ago

Still waiting

lrowe commented 10 years ago

Apologies for the delay in getting to this.

The intended mechanism to trigger a subtransaction with zope.sqlalchemy is to use transaction.savepoint(). This ensures that other data managers participating in the transaction will also have their data rolled back to the same point.

Clearly that won't work when integrating existing code that uses session.begin_nested(), so I think this would be best to make this an option like keep_session. We'll also need a test for this feature.

lrowe commented 10 years ago

On reconsidering, adding additional configuration around this isn't really warranted.

aadis commented 10 years ago

Thanks