MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / close

Method close

lib/sqlalchemy/engine/result.py:529–549  ·  view source on GitHub ↗

Hard close this :class:`_engine.Result`. The behavior of this method is implementation specific, and is not implemented by default. The method should generally end the resources in use by the result object and also cause any subsequent iteration or row fetching to

(self)

Source from the content-addressed store, hash-verified

527 self.close()
528
529 def close(self) -> None:
530 """Hard close this :class:`_engine.Result`.
531
532 The behavior of this method is implementation specific, and is
533 not implemented by default. The method should generally end
534 the resources in use by the result object and also cause any
535 subsequent iteration or row fetching to raise
536 :class:`.ResourceClosedError`.
537
538 .. versionadded:: 1.4.27 - ``.close()`` was previously not generally
539 available for all :class:`_engine.Result` classes, instead only
540 being available on the :class:`_engine.CursorResult` returned for
541 Core statement executions. As most other result objects, namely the
542 ones used by the ORM, are proxying a :class:`_engine.CursorResult`
543 in any case, this allows the underlying cursor result to be closed
544 from the outside facade for the case when the ORM query is using
545 the ``yield_per`` execution option where it does not immediately
546 exhaust and autoclose the database cursor.
547
548 """
549 self._soft_close(hard=True)
550
551 @property
552 def _soft_closed(self) -> bool:

Callers 6

__exit__Method · 0.95
_init_engineMethod · 0.45
_operation_contextMethod · 0.45
closeMethod · 0.45
do_closeMethod · 0.45
do_pingMethod · 0.45

Calls 1

_soft_closeMethod · 0.45

Tested by

no test coverage detected