MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / PoolResetState

Class PoolResetState

lib/sqlalchemy/pool/base.py:50–91  ·  view source on GitHub ↗

describes the state of a DBAPI connection as it is being passed to the :meth:`.PoolEvents.reset` connection pool event. .. versionadded:: 2.0.0b3

Source from the content-addressed store, hash-verified

48
49@dataclasses.dataclass(frozen=True)
50class PoolResetState:
51 """describes the state of a DBAPI connection as it is being passed to
52 the :meth:`.PoolEvents.reset` connection pool event.
53
54 .. versionadded:: 2.0.0b3
55
56 """
57
58 __slots__ = ("transaction_was_reset", "terminate_only", "asyncio_safe")
59
60 transaction_was_reset: bool
61 """Indicates if the transaction on the DBAPI connection was already
62 essentially "reset" back by the :class:`.Connection` object.
63
64 This boolean is True if the :class:`.Connection` had transactional
65 state present upon it, which was then not closed using the
66 :meth:`.Connection.rollback` or :meth:`.Connection.commit` method;
67 instead, the transaction was closed inline within the
68 :meth:`.Connection.close` method so is guaranteed to remain non-present
69 when this event is reached.
70
71 """
72
73 terminate_only: bool
74 """indicates if the connection is to be immediately terminated and
75 not checked in to the pool.
76
77 This occurs for connections that were invalidated, as well as asyncio
78 connections that were not cleanly handled by the calling code that
79 are instead being garbage collected. In the latter case,
80 operations can't be safely run on asyncio connections within garbage
81 collection as there is not necessarily an event loop present.
82
83 """
84
85 asyncio_safe: bool
86 """Indicates if the reset operation is occurring within a scope where
87 an enclosing event loop is expected to be present for asyncio applications.
88
89 Will be False in the case that the connection is being garbage collected.
90
91 """
92
93
94class ResetStyle(Enum):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by 4

test_customMethod · 0.72
test_plain_rollbackMethod · 0.72