]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Improve session after_begin even documentation
authorFederico Caselli <cfederico87@gmail.com>
Thu, 30 Nov 2023 21:40:43 +0000 (22:40 +0100)
committerFederico Caselli <cfederico87@gmail.com>
Tue, 5 Dec 2023 22:37:15 +0000 (23:37 +0100)
Change-Id: Ie2a1e6bdf5960208921dc76e372fe51d3b280f1a
References: #10687

lib/sqlalchemy/orm/events.py

index e7e3e32a7ff3a3a135652ede4d90dfd02ba18ea7..1a54dfd49a5d28a61069adfb53ff784c424c85a7 100644 (file)
@@ -2035,7 +2035,14 @@ class SessionEvents(event.Events[Session]):
         transaction: SessionTransaction,
         connection: Connection,
     ) -> None:
-        """Execute after a transaction is begun on a connection
+        """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 event;
+          do not run SQL operations using the :class:`_orm.Session`
+          directly.
 
         :param session: The target :class:`.Session`.
         :param transaction: The :class:`.SessionTransaction`.