Skip to content

Commit 21068a3

Browse files
fix: de-complicate earlier connection open logic
earlier, one of the integration tests was failing because 'session was not an attribute of Connection'. This is likely tied to a local configuration issue related to unittest that was causing an error in the test suite itself. The tests are now passing without checking for the session attribute. c676f9b Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent d21d2c3 commit 21068a3

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/databricks/sql/client.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,7 @@ def get_protocol_version(openSessionResp):
343343
@property
344344
def open(self) -> bool:
345345
"""Return whether the connection is open by checking if the session is open."""
346-
# NOTE: we have to check for the existence of session in case the __del__ is called
347-
# before the session is instantiated
348-
return hasattr(self, "session") and self.session.open
346+
return self.session.is_open
349347

350348
def cursor(
351349
self,

src/databricks/sql/session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def __init__(
3131
3232
This class handles all session-related behavior and communication with the backend.
3333
"""
34-
self.open = False
34+
self.is_open = False
3535
self.host = server_hostname
3636
self.port = kwargs.get("_port", 443)
3737

@@ -151,4 +151,4 @@ def close(self) -> None:
151151
except Exception as e:
152152
logger.error(f"Attempt to close session raised a local exception: {e}")
153153

154-
self.open = False
154+
self.is_open = False

0 commit comments

Comments
 (0)