MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / rollback

Method rollback

lib/sqlalchemy/engine/base.py:1016–1040  ·  view source on GitHub ↗

Roll back the transaction that is currently in progress. This method rolls back the current transaction if one has been started. If no transaction was started, the method has no effect. If a transaction was started and the connection is in an invalidated state, the

(self)

Source from the content-addressed store, hash-verified

1014 self._transaction.commit()
1015
1016 def rollback(self) -> None:
1017 """Roll back the transaction that is currently in progress.
1018
1019 This method rolls back the current transaction if one has been started.
1020 If no transaction was started, the method has no effect. If a
1021 transaction was started and the connection is in an invalidated state,
1022 the transaction is cleared using this method.
1023
1024 A transaction is begun on a :class:`_engine.Connection` automatically
1025 whenever a statement is first executed, or when the
1026 :meth:`_engine.Connection.begin` method is called.
1027
1028 .. note:: The :meth:`_engine.Connection.rollback` method only acts
1029 upon the primary database transaction that is linked to the
1030 :class:`_engine.Connection` object. It does not operate upon a
1031 SAVEPOINT that would have been invoked from the
1032 :meth:`_engine.Connection.begin_nested` method; for control of a
1033 SAVEPOINT, call :meth:`_engine.NestedTransaction.rollback` on the
1034 :class:`_engine.NestedTransaction` that is returned by the
1035 :meth:`_engine.Connection.begin_nested` method itself.
1036
1037
1038 """
1039 if self._transaction:
1040 self._transaction.rollback()
1041
1042 def recover_twophase(self) -> List[Any]:
1043 return self.engine.dialect.do_recover_twophase(self)

Callers 2

_rollback_implMethod · 0.45
do_rollbackMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected