MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _do_commit

Method _do_commit

lib/sqlalchemy/engine/base.py:2831–2849  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2829 self._close_impl(True, True)
2830
2831 def _do_commit(self) -> None:
2832 if self.is_active:
2833 try:
2834 self.connection._release_savepoint_impl(self._savepoint)
2835 finally:
2836 # nested trans becomes inactive on failed release
2837 # unconditionally. this prevents it from trying to
2838 # emit SQL when it rolls back.
2839 self.is_active = False
2840
2841 # but only de-associate from connection if it succeeded
2842 self._deactivate_from_connection()
2843 else:
2844 if self.connection._nested_transaction is self:
2845 self.connection._invalid_transaction()
2846 else:
2847 raise exc.InvalidRequestError(
2848 "This nested transaction is inactive"
2849 )
2850
2851
2852class TwoPhaseTransaction(RootTransaction):

Callers

nothing calls this directly

Calls 3

_invalid_transactionMethod · 0.80

Tested by

no test coverage detected