From fc6012638a8baaf9cb4703ae39bbff2e67298c58 Mon Sep 17 00:00:00 2001 From: NI1993 <60190218+NI1993@users.noreply.github.com> Date: Wed, 30 Oct 2024 11:16:27 +0200 Subject: [PATCH] feat: added `is_closed` method to connection class --- redshift_connector/core.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/redshift_connector/core.py b/redshift_connector/core.py index 3c12530..a0d7fb0 100644 --- a/redshift_connector/core.py +++ b/redshift_connector/core.py @@ -1385,6 +1385,15 @@ def close(self: "Connection") -> None: self._usock.close() self._sock = None # type: ignore + def is_closed(self: "Connection") -> bool: + """Returns if the connection instance is closed. + + Returns + ------- + bool:bool + """ + return self._sock is None + def handle_AUTHENTICATION_REQUEST(self: "Connection", data: bytes, cursor: Cursor) -> None: """ Handler for AuthenticationRequest message received via Amazon Redshift wire protocol, represented by