Execute after a transaction is begun on a connection. .. note:: This event is called within the process of the :class:`_orm.Session` modifying its own internal state. To invoke SQL operations within this hook, use the :class:`_engine.Connection` provided to the
(
self,
session: Session,
transaction: SessionTransaction,
connection: Connection,
)
| 2010 | """ |
| 2011 | |
| 2012 | def after_begin( |
| 2013 | self, |
| 2014 | session: Session, |
| 2015 | transaction: SessionTransaction, |
| 2016 | connection: Connection, |
| 2017 | ) -> None: |
| 2018 | """Execute after a transaction is begun on a connection. |
| 2019 | |
| 2020 | .. note:: This event is called within the process of the |
| 2021 | :class:`_orm.Session` modifying its own internal state. |
| 2022 | To invoke SQL operations within this hook, use the |
| 2023 | :class:`_engine.Connection` provided to the event; |
| 2024 | do not run SQL operations using the :class:`_orm.Session` |
| 2025 | directly. |
| 2026 | |
| 2027 | :param session: The target :class:`.Session`. |
| 2028 | :param transaction: The :class:`.SessionTransaction`. |
| 2029 | :param connection: The :class:`_engine.Connection` object |
| 2030 | which will be used for SQL statements. |
| 2031 | |
| 2032 | .. seealso:: |
| 2033 | |
| 2034 | :meth:`~.SessionEvents.before_commit` |
| 2035 | |
| 2036 | :meth:`~.SessionEvents.after_commit` |
| 2037 | |
| 2038 | :meth:`~.SessionEvents.after_transaction_create` |
| 2039 | |
| 2040 | :meth:`~.SessionEvents.after_transaction_end` |
| 2041 | |
| 2042 | """ |
| 2043 | |
| 2044 | @_lifecycle_event |
| 2045 | def before_attach(self, session: Session, instance: _O) -> None: |
no outgoing calls
no test coverage detected