Skip to content

Commit d2035ea

Browse files
use connection open property instead of long chain through session
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 44e7d17 commit d2035ea

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/databricks/sql/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def __exit__(self, exc_type, exc_value, traceback):
308308
return False
309309

310310
def __del__(self):
311-
if self.session.open:
311+
if self.open:
312312
logger.debug(
313313
"Closing unclosed connection for session "
314314
"{}".format(self.get_session_id_hex())
@@ -357,7 +357,7 @@ def cursor(
357357
358358
Will throw an Error if the connection has been closed.
359359
"""
360-
if not self.session.open:
360+
if not self.open:
361361
raise Error("Cannot create cursor from closed connection")
362362

363363
cursor = Cursor(
@@ -1502,7 +1502,7 @@ def close(self) -> None:
15021502
if (
15031503
self.op_state != ttypes.TOperationState.CLOSED_STATE
15041504
and not self.has_been_closed_server_side
1505-
and self.connection.session.open
1505+
and self.connection.open
15061506
):
15071507
self.backend.close_command(self.command_id)
15081508
except RequestError as e:

0 commit comments

Comments
 (0)