MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / invalidate

Method invalidate

lib/sqlalchemy/pool/base.py:1474–1488  ·  view source on GitHub ↗
(
        self, e: Optional[BaseException] = None, soft: bool = False
    )

Source from the content-addressed store, hash-verified

1472 return self._connection_record.record_info
1473
1474 def invalidate(
1475 self, e: Optional[BaseException] = None, soft: bool = False
1476 ) -> None:
1477 if self.dbapi_connection is None:
1478 util.warn("Can't invalidate an already-closed connection.")
1479 return
1480 if self._connection_record:
1481 self._connection_record.invalidate(e=e, soft=soft)
1482 if not soft:
1483 # prevent any rollback / reset actions etc. on
1484 # the connection
1485 self.dbapi_connection = None # type: ignore
1486
1487 # finalize
1488 self._checkin()
1489
1490 def cursor(self, *args: Any, **kwargs: Any) -> DBAPICursor:
1491 assert self.dbapi_connection is not None

Callers 4

_invalidateMethod · 0.45
invalidateMethod · 0.45
_finalize_fairyFunction · 0.45
_checkoutMethod · 0.45

Calls 2

_checkinMethod · 0.95
warnMethod · 0.45

Tested by

no test coverage detected