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

Method rollback

lib/sqlalchemy/orm/session.py:2019–2038  ·  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

2017 return self.begin(nested=True)
2018
2019 def rollback(self) -> None:
2020 """Rollback the current transaction in progress.
2021
2022 If no transaction is in progress, this method is a pass-through.
2023
2024 The method always rolls back
2025 the topmost database transaction, discarding any nested
2026 transactions that may be in progress.
2027
2028 .. seealso::
2029
2030 :ref:`session_rollback`
2031
2032 :ref:`unitofwork_transaction`
2033
2034 """
2035 if self._transaction is None:
2036 pass
2037 else:
2038 self._transaction.rollback(_to_root=True)
2039
2040 def commit(self) -> None:
2041 """Flush pending changes and commit the current transaction.

Calls

no outgoing calls