MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / before_commit

Method before_commit

lib/sqlalchemy/orm/events.py:1818–1844  ·  view source on GitHub ↗

Execute before commit is called. .. note:: The :meth:`~.SessionEvents.before_commit` hook is *not* per-flush, that is, the :class:`.Session` can emit SQL to the database many times within the scope of a transaction. For interception of these

(self, session: Session)

Source from the content-addressed store, hash-verified

1816 """
1817
1818 def before_commit(self, session: Session) -> None:
1819 """Execute before commit is called.
1820
1821 .. note::
1822
1823 The :meth:`~.SessionEvents.before_commit` hook is *not* per-flush,
1824 that is, the :class:`.Session` can emit SQL to the database
1825 many times within the scope of a transaction.
1826 For interception of these events, use the
1827 :meth:`~.SessionEvents.before_flush`,
1828 :meth:`~.SessionEvents.after_flush`, or
1829 :meth:`~.SessionEvents.after_flush_postexec`
1830 events.
1831
1832 :param session: The target :class:`.Session`.
1833
1834 .. seealso::
1835
1836 :meth:`~.SessionEvents.after_commit`
1837
1838 :meth:`~.SessionEvents.after_begin`
1839
1840 :meth:`~.SessionEvents.after_transaction_create`
1841
1842 :meth:`~.SessionEvents.after_transaction_end`
1843
1844 """
1845
1846 def after_commit(self, session: Session) -> None:
1847 """Execute after a commit has occurred.

Callers 1

_prepare_implMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected