Skip to content

Commit 6a96a49

Browse files
committed
PECOBLR-86 Improve logging for debug level
1 parent 3463b12 commit 6a96a49

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/databricks/sql/client.py

+3
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ def read(self) -> Optional[OAuthToken]:
214214
# use_cloud_fetch
215215
# Enable use of cloud fetch to extract large query results in parallel via cloud storage
216216

217+
logger.debug(f"Connection.__init__(server_hostname={server_hostname}, http_path={http_path})")
218+
217219
if access_token:
218220
access_token_kv = {"access_token": access_token}
219221
kwargs = {**kwargs, **access_token_kv}
@@ -787,6 +789,7 @@ def execute(
787789
788790
:returns self
789791
"""
792+
logger.debug(f"Cursor.execute(operation={operation}, parameters={parameters})")
790793

791794
param_approach = self._determine_parameter_approach(parameters)
792795
if param_approach == ParameterApproach.NONE:

src/databricks/sql/thrift_backend.py

+7
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ def __init__(
131131
# max_download_threads
132132
# Number of threads for handling cloud fetch downloads. Defaults to 10
133133

134+
logger.debug(f"ThriftBackend.__init__(server_hostname={server_hostname}, port={port}, http_path={http_path})")
135+
134136
port = port or 443
135137
if kwargs.get("_connection_uri"):
136138
uri = kwargs.get("_connection_uri")
@@ -390,6 +392,8 @@ def attempt_request(attempt):
390392

391393
# TODO: don't use exception handling for GOS polling...
392394

395+
logger.debug(f"ThriftBackend.attempt_request: HTTPError: {err}")
396+
393397
gos_name = TCLIServiceClient.GetOperationStatus.__name__
394398
if method.__name__ == gos_name:
395399
delay_default = (
@@ -404,6 +408,7 @@ def attempt_request(attempt):
404408
else:
405409
raise err
406410
except OSError as err:
411+
logger.debug(f"ThriftBackend.attempt_request: OSError: {err}")
407412
error = err
408413
error_message = str(err)
409414
# fmt: off
@@ -434,6 +439,7 @@ def attempt_request(attempt):
434439
else:
435440
logger.warning(log_string)
436441
except Exception as err:
442+
logger.debug(f"ThriftBackend.attempt_request: Exception: {err}")
437443
error = err
438444
retry_delay = extract_retry_delay(attempt)
439445
error_message = ThriftBackend._extract_error_message_from_headers(
@@ -1074,6 +1080,7 @@ def fetch_results(
10741080
return queue, resp.hasMoreRows
10751081

10761082
def close_command(self, op_handle):
1083+
logger.debug(f"ThriftBackend.close_command(op_handle={op_handle})")
10771084
req = ttypes.TCloseOperationReq(operationHandle=op_handle)
10781085
resp = self.make_request(self._client.CloseOperation, req)
10791086
return resp.status

0 commit comments

Comments
 (0)