Skip to content

Commit b661029

Browse files
committed
removed unused errors
Signed-off-by: Sai Shree Pradhan <saishree.pradhan@databricks.com>
1 parent 2c11c46 commit b661029

File tree

3 files changed

+5
-51
lines changed

3 files changed

+5
-51
lines changed

src/databricks/sql/client.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@
2121
InterfaceError,
2222
NotSupportedError,
2323
ProgrammingError,
24-
AuthenticationError,
25-
ConnectionError,
2624
)
27-
from urllib3.exceptions import MaxRetryError
25+
2826
from databricks.sql.thrift_api.TCLIService import ttypes
2927
from databricks.sql.thrift_backend import ThriftBackend
3028
from databricks.sql.utils import (

src/databricks/sql/exc.py

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -126,46 +126,3 @@ class SessionAlreadyClosedError(RequestError):
126126

127127
class 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)

src/databricks/sql/telemetry/telemetry_client.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import uuid
3737
import locale
3838
from databricks.sql.telemetry.utils import BaseTelemetryClient
39-
import json
4039

4140
logger = 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

0 commit comments

Comments
 (0)