MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / invalidate

Method invalidate

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

Source from the content-addressed store, hash-verified

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