diff --git a/postgres/datadog_checks/postgres/connections.py b/postgres/datadog_checks/postgres/connections.py index f3ff80fcc22fd..fd729a45d272c 100644 --- a/postgres/datadog_checks/postgres/connections.py +++ b/postgres/datadog_checks/postgres/connections.py @@ -23,10 +23,10 @@ def __str__(self): class ConnectionInfo: def __init__( self, - connection: psycopg2.extensions.connection, - deadline: int, + connection: psycopg.Connection, + deadline: datetime, active: bool, - last_accessed: int, + last_accessed: datetime, thread: threading.Thread, ): self.connection = connection @@ -79,7 +79,7 @@ def __init__(self, connect_fn: Callable[[str], None], max_conns: int = None): ) self.connect_fn = connect_fn - def _get_connection_raw(self, dbname: str, ttl_ms: int, timeout: int = None) -> psycopg2.extensions.connection: + def _get_connection_raw(self, dbname: str, ttl_ms: int, timeout: int = None) -> psycopg.Connection: """ Return a connection from the pool. """ @@ -183,6 +183,6 @@ def _terminate_connection_unsafe(self, dbname: str): db.close() except Exception: self._stats.connection_closed_failed += 1 - self._log.exception("failed to close DB connection for db=%s", dbname) + self.log.exception("failed to close DB connection for db=%s", dbname) return False return True diff --git a/postgres/pyproject.toml b/postgres/pyproject.toml index cca5eb5ba5651..3ebab24ffef69 100644 --- a/postgres/pyproject.toml +++ b/postgres/pyproject.toml @@ -42,7 +42,6 @@ deps = [ "cachetools==5.3.1; python_version > '3.0'", "psycopg[binary]==3.1.9; python_version > '3.0'", "semver==3.0.1; python_version > '3.0'", - "psycopg[pool]==3.1.7; python_version > '3.0'", ] [project.urls]