Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc676f9b

Browse files
fix: ensure open attribute of Connection never fails
in case the openSession takes long, the initialisation of the sessionwill not complete immediately. This could make the session attributeinaccessible. If the Connection is deleted in this time, the open()check will throw because the session attribute does not exist. Thus, wedefault to the Connection being closed in this case. This was not anissue before because open was a direct attribute of the Connectionclass. Caught in the integration tests.Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent078f91a commitc676f9b

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
@@ -19,8 +19,6 @@
1919
OperationalError,
2020
SessionAlreadyClosedError,
2121
CursorAlreadyClosedError,
22-
Error,
23-
NotSupportedError,
2422
)
2523
fromdatabricks.sql.thrift_api.TCLIServiceimportttypes
2624
fromdatabricks.sql.thrift_backendimportThriftBackend
@@ -319,7 +317,9 @@ def get_protocol_version(openSessionResp):
319317
@property
320318
defopen(self)->bool:
321319
"""Return whether the connection is open by checking if the session is open."""
322-
returnself.session.open
320+
# NOTE: we have to check for the existence of session in case the __del__ is called
321+
# before the session is instantiated
322+
returnhasattr(self,"session")andself.session.open
323323

324324
defcursor(
325325
self,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp