File tree Expand file tree Collapse file tree 3 files changed +5
-51
lines changed
Expand file tree Collapse file tree 3 files changed +5
-51
lines changed Original file line number Diff line number Diff line change 2121 InterfaceError ,
2222 NotSupportedError ,
2323 ProgrammingError ,
24- AuthenticationError ,
25- ConnectionError ,
2624)
27- from urllib3 . exceptions import MaxRetryError
25+
2826from databricks .sql .thrift_api .TCLIService import ttypes
2927from databricks .sql .thrift_backend import ThriftBackend
3028from databricks .sql .utils import (
Original file line number Diff line number Diff line change @@ -126,46 +126,3 @@ class SessionAlreadyClosedError(RequestError):
126126
127127class CursorAlreadyClosedError (RequestError ):
128128 """Thrown if CancelOperation receives a code 404. ThriftBackend should gracefully proceed as this is expected."""
129-
130-
131- class ConnectionError (OperationalError ):
132- """Thrown when connection to Databricks fails during initial setup"""
133-
134- def __init__ (
135- self ,
136- message = None ,
137- host_url = None ,
138- http_path = None ,
139- port = 443 ,
140- user_agent = None ,
141- original_exception = None ,
142- ** kwargs
143- ):
144- # Set up context for connection error telemetry
145- context = kwargs .get ("context" , {})
146- if host_url :
147- context .update (
148- {
149- "host_url" : host_url ,
150- "http_path" : http_path or "" ,
151- "port" : port ,
152- "user_agent" : user_agent ,
153- "original_exception" : str (original_exception )
154- if original_exception
155- else None ,
156- }
157- )
158-
159- super ().__init__ (message = message , context = context , ** kwargs )
160-
161-
162- class AuthenticationError (ConnectionError ):
163- """Thrown when authentication to Databricks fails"""
164-
165- def __init__ (self , message = None , auth_type = None , ** kwargs ):
166- context = kwargs .get ("context" , {})
167- if auth_type :
168- context ["auth_type" ] = auth_type
169- kwargs ["context" ] = context
170-
171- super ().__init__ (message = message , ** kwargs )
Original file line number Diff line number Diff line change 3636import uuid
3737import locale
3838from databricks .sql .telemetry .utils import BaseTelemetryClient
39- import json
4039
4140logger = logging .getLogger (__name__ )
4241
@@ -450,21 +449,21 @@ def connection_failure_log(
450449 ):
451450 """Send error telemetry when connection creation fails, without requiring a session"""
452451
453- UNAUTH_SESSION_ID = "Unauth_session_id "
452+ UNAUTH_DUMMY_SESSION_ID = "unauth_session_id "
454453
455454 TelemetryClientFactory .initialize_telemetry_client (
456455 telemetry_enabled = True ,
457- session_id_hex = UNAUTH_SESSION_ID ,
456+ session_id_hex = UNAUTH_DUMMY_SESSION_ID ,
458457 auth_provider = None ,
459458 host_url = host_url ,
460459 )
461460
462461 telemetry_client = TelemetryClientFactory .get_telemetry_client (
463- UNAUTH_SESSION_ID
462+ UNAUTH_DUMMY_SESSION_ID
464463 )
465464 telemetry_client ._driver_connection_params = DriverConnectionParameters (
466465 http_path = http_path ,
467- mode = DatabricksClientType .THRIFT ,
466+ mode = DatabricksClientType .THRIFT , # TODO: Add SEA mode
468467 host_info = HostDetails (host_url = host_url , port = port ),
469468 )
470469 telemetry_client ._user_agent = user_agent
You can’t perform that action at this time.
0 commit comments