diff --git a/src/databricks/sql/client.py b/src/databricks/sql/client.py index ea901c3a..87f3bbb9 100755 --- a/src/databricks/sql/client.py +++ b/src/databricks/sql/client.py @@ -214,6 +214,12 @@ def read(self) -> Optional[OAuthToken]: # use_cloud_fetch # Enable use of cloud fetch to extract large query results in parallel via cloud storage + logger.debug( + "Connection.__init__(server_hostname=%s, http_path=%s)", + server_hostname, + http_path, + ) + if access_token: access_token_kv = {"access_token": access_token} kwargs = {**kwargs, **access_token_kv} @@ -787,6 +793,9 @@ def execute( :returns self """ + logger.debug( + "Cursor.execute(operation=%s, parameters=%s)", operation, parameters + ) param_approach = self._determine_parameter_approach(parameters) if param_approach == ParameterApproach.NONE: diff --git a/src/databricks/sql/thrift_backend.py b/src/databricks/sql/thrift_backend.py index 2e3478d7..43f800dd 100644 --- a/src/databricks/sql/thrift_backend.py +++ b/src/databricks/sql/thrift_backend.py @@ -131,6 +131,13 @@ def __init__( # max_download_threads # Number of threads for handling cloud fetch downloads. Defaults to 10 + logger.debug( + "ThriftBackend.__init__(server_hostname=%s, port=%s, http_path=%s)", + server_hostname, + port, + http_path, + ) + port = port or 443 if kwargs.get("_connection_uri"): uri = kwargs.get("_connection_uri") @@ -390,6 +397,8 @@ def attempt_request(attempt): # TODO: don't use exception handling for GOS polling... + logger.error("ThriftBackend.attempt_request: HTTPError: %s", err) + gos_name = TCLIServiceClient.GetOperationStatus.__name__ if method.__name__ == gos_name: delay_default = ( @@ -434,6 +443,7 @@ def attempt_request(attempt): else: logger.warning(log_string) except Exception as err: + logger.error("ThriftBackend.attempt_request: Exception: %s", err) error = err retry_delay = extract_retry_delay(attempt) error_message = ThriftBackend._extract_error_message_from_headers( @@ -888,6 +898,12 @@ def execute_command( ): assert session_handle is not None + logger.debug( + "ThriftBackend.execute_command(operation=%s, session_handle=%s)", + operation, + session_handle, + ) + spark_arrow_types = ttypes.TSparkArrowTypes( timestampAsArrow=self._use_arrow_native_timestamps, decimalAsArrow=self._use_arrow_native_decimals, @@ -1074,6 +1090,7 @@ def fetch_results( return queue, resp.hasMoreRows def close_command(self, op_handle): + logger.debug(f"ThriftBackend.close_command(op_handle={op_handle})") req = ttypes.TCloseOperationReq(operationHandle=op_handle) resp = self.make_request(self._client.CloseOperation, req) return resp.status