This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
# pool/base.py
|
||||
# Copyright (C) 2005-2025 the SQLAlchemy authors and contributors
|
||||
# sqlalchemy/pool.py
|
||||
# Copyright (C) 2005-2023 the SQLAlchemy authors and contributors
|
||||
# <see AUTHORS file>
|
||||
#
|
||||
# This module is part of SQLAlchemy and is released under
|
||||
# the MIT License: https://www.opensource.org/licenses/mit-license.php
|
||||
|
||||
|
||||
"""Base constructs for connection pools."""
|
||||
"""Base constructs for connection pools.
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -145,14 +147,17 @@ class _AsyncConnDialect(_ConnDialect):
|
||||
|
||||
|
||||
class _CreatorFnType(Protocol):
|
||||
def __call__(self) -> DBAPIConnection: ...
|
||||
def __call__(self) -> DBAPIConnection:
|
||||
...
|
||||
|
||||
|
||||
class _CreatorWRecFnType(Protocol):
|
||||
def __call__(self, rec: ConnectionPoolEntry) -> DBAPIConnection: ...
|
||||
def __call__(self, rec: ConnectionPoolEntry) -> DBAPIConnection:
|
||||
...
|
||||
|
||||
|
||||
class Pool(log.Identified, event.EventTarget):
|
||||
|
||||
"""Abstract base class for connection pools."""
|
||||
|
||||
dispatch: dispatcher[Pool]
|
||||
@@ -466,7 +471,6 @@ class Pool(log.Identified, event.EventTarget):
|
||||
raise NotImplementedError()
|
||||
|
||||
def status(self) -> str:
|
||||
"""Returns a brief description of the state of this pool."""
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
@@ -629,6 +633,7 @@ class ConnectionPoolEntry(ManagesConnection):
|
||||
|
||||
|
||||
class _ConnectionRecord(ConnectionPoolEntry):
|
||||
|
||||
"""Maintains a position in a connection pool which references a pooled
|
||||
connection.
|
||||
|
||||
@@ -724,13 +729,11 @@ class _ConnectionRecord(ConnectionPoolEntry):
|
||||
|
||||
rec.fairy_ref = ref = weakref.ref(
|
||||
fairy,
|
||||
lambda ref: (
|
||||
_finalize_fairy(
|
||||
None, rec, pool, ref, echo, transaction_was_reset=False
|
||||
)
|
||||
if _finalize_fairy is not None
|
||||
else None
|
||||
),
|
||||
lambda ref: _finalize_fairy(
|
||||
None, rec, pool, ref, echo, transaction_was_reset=False
|
||||
)
|
||||
if _finalize_fairy is not None
|
||||
else None,
|
||||
)
|
||||
_strong_ref_connection_records[ref] = rec
|
||||
if echo:
|
||||
@@ -1071,13 +1074,14 @@ class PoolProxiedConnection(ManagesConnection):
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
|
||||
def commit(self) -> None: ...
|
||||
def commit(self) -> None:
|
||||
...
|
||||
|
||||
def cursor(self, *args: Any, **kwargs: Any) -> DBAPICursor: ...
|
||||
def cursor(self) -> DBAPICursor:
|
||||
...
|
||||
|
||||
def rollback(self) -> None: ...
|
||||
|
||||
def __getattr__(self, key: str) -> Any: ...
|
||||
def rollback(self) -> None:
|
||||
...
|
||||
|
||||
@property
|
||||
def is_valid(self) -> bool:
|
||||
@@ -1185,6 +1189,7 @@ class _AdhocProxiedConnection(PoolProxiedConnection):
|
||||
|
||||
|
||||
class _ConnectionFairy(PoolProxiedConnection):
|
||||
|
||||
"""Proxies a DBAPI connection and provides return-on-dereference
|
||||
support.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user