The scoped session manager will by default return the same session object for each connection. Accordingly, one can replace .commit
with .flush
, and have that change persist across invocations to the session manager.
That will prevent commits.
To then rollback all changes, one should use session.transaction.rollback()
.