MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / rollback

Method rollback

lib/sqlalchemy/orm/session.py:1978–1997  ·  view source on GitHub ↗

Rollback the current transaction in progress. If no transaction is in progress, this method is a pass-through. The method always rolls back the topmost database transaction, discarding any nested transactions that may be in progress. .. seealso::

(self)

Source from the content-addressed store, hash-verified

1976 return self.begin(nested=True)
1977
1978 def rollback(self) -> None:
1979 """Rollback the current transaction in progress.
1980
1981 If no transaction is in progress, this method is a pass-through.
1982
1983 The method always rolls back
1984 the topmost database transaction, discarding any nested
1985 transactions that may be in progress.
1986
1987 .. seealso::
1988
1989 :ref:`session_rollback`
1990
1991 :ref:`unitofwork_transaction`
1992
1993 """
1994 if self._transaction is None:
1995 pass
1996 else:
1997 self._transaction.rollback(_to_root=True)
1998
1999 def commit(self) -> None:
2000 """Flush pending changes and commit the current transaction.

Calls

no outgoing calls