MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _do_get

Method _do_get

lib/sqlalchemy/pool/impl.py:421–436  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

419 pass
420
421 def _do_get(self) -> ConnectionPoolEntry:
422 try:
423 if TYPE_CHECKING:
424 c = cast(ConnectionPoolEntry, self._conn.current())
425 else:
426 c = self._conn.current()
427 if c:
428 return c
429 except AttributeError:
430 pass
431 c = self._create_connection()
432 self._conn.current = weakref.ref(c)
433 if len(self._all_conns) >= self.size:
434 self._cleanup()
435 self._all_conns.add(c)
436 return c
437
438 def connect(self) -> PoolProxiedConnection:
439 # vendored from Pool to include the now removed use_threadlocal

Callers

nothing calls this directly

Calls 4

_cleanupMethod · 0.95
castFunction · 0.50
_create_connectionMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected