MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / NoCursorDQLFetchStrategy

Class NoCursorDQLFetchStrategy

lib/sqlalchemy/engine/cursor.py:1183–1207  ·  view source on GitHub ↗

Cursor strategy for a DQL result that has no open cursor. This is a result set that can return rows, i.e. for a SELECT, or for an INSERT, UPDATE, DELETE that includes RETURNING. However it is in the state where the cursor is closed and no rows remain available. The owning result ob

Source from the content-addressed store, hash-verified

1181
1182
1183class NoCursorDQLFetchStrategy(NoCursorFetchStrategy):
1184 """Cursor strategy for a DQL result that has no open cursor.
1185
1186 This is a result set that can return rows, i.e. for a SELECT, or for an
1187 INSERT, UPDATE, DELETE that includes RETURNING. However it is in the state
1188 where the cursor is closed and no rows remain available. The owning result
1189 object may or may not be "hard closed", which determines if the fetch
1190 methods send empty results or raise for closed result.
1191
1192 """
1193
1194 __slots__ = ()
1195
1196 def _non_result(
1197 self,
1198 result: CursorResult[Unpack[TupleAny]],
1199 default: Any,
1200 err: Optional[BaseException] = None,
1201 ) -> Any:
1202 if result.closed:
1203 raise exc.ResourceClosedError(
1204 "This result object is closed."
1205 ) from err
1206 else:
1207 return default
1208
1209
1210_NO_CURSOR_DQL = NoCursorDQLFetchStrategy()

Callers 1

cursor.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected