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

Commitfe3acb1

Browse files
replace getters with property tag
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parentc20058e commitfe3acb1

File tree

3 files changed

+24
-26
lines changed

3 files changed

+24
-26
lines changed

‎src/databricks/sql/backend/types.py‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def __str__(self) -> str:
139139
ifisinstance(self.secret,bytes)
140140
elsestr(self.secret)
141141
)
142-
returnf"{self.get_hex_guid()}|{secret_hex}"
142+
returnf"{self.hex_guid}|{secret_hex}"
143143
returnstr(self.guid)
144144

145145
@classmethod
@@ -217,14 +217,8 @@ def to_sea_session_id(self):
217217

218218
returnself.guid
219219

220-
defget_guid(self)->Any:
221-
"""
222-
Get the ID of the session.
223-
"""
224-
225-
returnself.guid
226-
227-
defget_hex_guid(self)->str:
220+
@property
221+
defhex_guid(self)->str:
228222
"""
229223
Get a hexadecimal string representation of the session ID.
230224
@@ -237,7 +231,8 @@ def get_hex_guid(self) -> str:
237231
else:
238232
returnstr(self.guid)
239233

240-
defget_protocol_version(self):
234+
@property
235+
defprotocol_version(self):
241236
"""
242237
Get the server protocol version for this session.
243238

‎src/databricks/sql/client.py‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,11 @@ def __del__(self):
304304

305305
defget_session_id(self):
306306
"""Get the raw session ID (backend-specific)"""
307-
returnself.session.get_id()
307+
returnself.session.guid
308308

309309
defget_session_id_hex(self):
310310
"""Get the session ID in hex format"""
311-
returnself.session.get_id_hex()
311+
returnself.session.guid_hex
312312

313313
@staticmethod
314314
defserver_parameterized_queries_enabled(protocolVersion):
@@ -784,7 +784,7 @@ def execute(
784784
self._close_and_clear_active_result_set()
785785
self.active_result_set=self.backend.execute_command(
786786
operation=prepared_operation,
787-
session_id=self.connection.session.get_session_id(),
787+
session_id=self.connection.session.session_id,
788788
max_rows=self.arraysize,
789789
max_bytes=self.buffer_size_bytes,
790790
lz4_compression=self.connection.lz4_compression,
@@ -840,7 +840,7 @@ def execute_async(
840840
self._close_and_clear_active_result_set()
841841
self.backend.execute_command(
842842
operation=prepared_operation,
843-
session_id=self.connection.session.get_session_id(),
843+
session_id=self.connection.session.session_id,
844844
max_rows=self.arraysize,
845845
max_bytes=self.buffer_size_bytes,
846846
lz4_compression=self.connection.lz4_compression,
@@ -927,7 +927,7 @@ def catalogs(self) -> "Cursor":
927927
self._check_not_closed()
928928
self._close_and_clear_active_result_set()
929929
self.active_result_set=self.backend.get_catalogs(
930-
session_id=self.connection.session.get_session_id(),
930+
session_id=self.connection.session.session_id,
931931
max_rows=self.arraysize,
932932
max_bytes=self.buffer_size_bytes,
933933
cursor=self,
@@ -946,7 +946,7 @@ def schemas(
946946
self._check_not_closed()
947947
self._close_and_clear_active_result_set()
948948
self.active_result_set=self.backend.get_schemas(
949-
session_id=self.connection.session.get_session_id(),
949+
session_id=self.connection.session.session_id,
950950
max_rows=self.arraysize,
951951
max_bytes=self.buffer_size_bytes,
952952
cursor=self,
@@ -972,7 +972,7 @@ def tables(
972972
self._close_and_clear_active_result_set()
973973

974974
self.active_result_set=self.backend.get_tables(
975-
session_id=self.connection.session.get_session_id(),
975+
session_id=self.connection.session.session_id,
976976
max_rows=self.arraysize,
977977
max_bytes=self.buffer_size_bytes,
978978
cursor=self,
@@ -1000,7 +1000,7 @@ def columns(
10001000
self._close_and_clear_active_result_set()
10011001

10021002
self.active_result_set=self.backend.get_columns(
1003-
session_id=self.connection.session.get_session_id(),
1003+
session_id=self.connection.session.session_id,
10041004
max_rows=self.arraysize,
10051005
max_bytes=self.buffer_size_bytes,
10061006
cursor=self,

‎src/databricks/sql/session.py‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ def open(self):
9595
)
9696
self.protocol_version=self.get_protocol_version(self._session_id)
9797
self.is_open=True
98-
logger.info("Successfully opened session %s",str(self.get_id_hex()))
98+
logger.info("Successfully opened session %s",str(self.guid_hex))
9999

100100
@staticmethod
101101
defget_protocol_version(session_id:SessionId):
102-
returnsession_id.get_protocol_version()
102+
returnsession_id.protocol_version
103103

104104
@staticmethod
105105
defserver_parameterized_queries_enabled(protocolVersion):
@@ -111,21 +111,24 @@ def server_parameterized_queries_enabled(protocolVersion):
111111
else:
112112
returnFalse
113113

114-
defget_session_id(self)->SessionId:
114+
@property
115+
defsession_id(self)->SessionId:
115116
"""Get the normalized session ID"""
116117
returnself._session_id
117118

118-
defget_id(self):
119+
@property
120+
defguid(self)->Any:
119121
"""Get the raw session ID (backend-specific)"""
120-
returnself._session_id.get_guid()
122+
returnself._session_id.guid
121123

122-
defget_id_hex(self)->str:
124+
@property
125+
defguid_hex(self)->str:
123126
"""Get the session ID in hex format"""
124-
returnself._session_id.get_hex_guid()
127+
returnself._session_id.hex_guid
125128

126129
defclose(self)->None:
127130
"""Close the underlying session."""
128-
logger.info("Closing session %s",self.get_id_hex())
131+
logger.info("Closing session %s",self.guid_hex)
129132
ifnotself.is_open:
130133
logger.debug("Session appears to have been closed already")
131134
return

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp