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)
| 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. |