Skip to content

Commit 7fc7492

Browse files
committed
- add session.close() w/ rationale to top-level "using transactions"
section. References #3974 Change-Id: Idb650cbe9825cfae893ee917132b5b9d693f0c6c
1 parent eed7888 commit 7fc7492

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

doc/build/orm/session_transaction.rst

+9
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ The example below illustrates this lifecycle::
7575
# as that of commit proceeds.
7676
session.rollback()
7777
raise
78+
finally:
79+
# close the Session. This will expunge any remaining
80+
# objects as well as reset any existing SessionTransaction
81+
# state. Neither of these steps are usually essential.
82+
# However, if the commit() or rollback() itself experienced
83+
# an unanticipated internal failure (such as due to a mis-behaved
84+
# user-defined event handler), .close() will ensure that
85+
# invalid state is removed.
86+
session.close()
7887

7988
.. _session_begin_nested:
8089

0 commit comments

Comments
 (0)