We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eed7888 commit 7fc7492Copy full SHA for 7fc7492
doc/build/orm/session_transaction.rst
@@ -75,6 +75,15 @@ The example below illustrates this lifecycle::
75
# as that of commit proceeds.
76
session.rollback()
77
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()
87
88
.. _session_begin_nested:
89
0 commit comments