Skip to content

Commit d79638b

Browse files
ValueError not ProgrammingError
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent cd119e9 commit d79638b

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/databricks/sql/backend/sea/backend.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
BackendType,
2828
ExecuteResponse,
2929
)
30-
from databricks.sql.exc import DatabaseError, ProgrammingError, ServerOperationError
30+
from databricks.sql.exc import DatabaseError, ServerOperationError
3131
from databricks.sql.backend.sea.utils.http_client import SeaHttpClient
3232
from databricks.sql.types import SSLOptions
3333

@@ -150,7 +150,7 @@ def _extract_warehouse_id(self, http_path: str) -> str:
150150
The extracted warehouse ID
151151
152152
Raises:
153-
ProgrammingError: If the warehouse ID cannot be extracted from the path
153+
ValueError: If the warehouse ID cannot be extracted from the path
154154
"""
155155

156156
warehouse_pattern = re.compile(r".*/warehouses/(.+)")
@@ -174,7 +174,7 @@ def _extract_warehouse_id(self, http_path: str) -> str:
174174
f"Note: SEA only works for warehouses."
175175
)
176176
logger.error(error_message)
177-
raise ProgrammingError(error_message)
177+
raise ValueError(error_message)
178178

179179
@property
180180
def max_download_threads(self) -> int:
@@ -246,7 +246,7 @@ def close_session(self, session_id: SessionId) -> None:
246246
session_id: The session identifier returned by open_session()
247247
248248
Raises:
249-
ProgrammingError: If the session ID is invalid
249+
ValueError: If the session ID is invalid
250250
OperationalError: If there's an error closing the session
251251
"""
252252

@@ -503,7 +503,7 @@ def cancel_command(self, command_id: CommandId) -> None:
503503
command_id: Command identifier to cancel
504504
505505
Raises:
506-
ProgrammingError: If the command ID is invalid
506+
ValueError: If the command ID is invalid
507507
"""
508508

509509
if command_id.backend_type != BackendType.SEA:
@@ -528,7 +528,7 @@ def close_command(self, command_id: CommandId) -> None:
528528
command_id: Command identifier to close
529529
530530
Raises:
531-
ProgrammingError: If the command ID is invalid
531+
ValueError: If the command ID is invalid
532532
"""
533533

534534
if command_id.backend_type != BackendType.SEA:
@@ -593,7 +593,7 @@ def get_execution_result(
593593
SeaResultSet: A SeaResultSet instance with the execution results
594594
595595
Raises:
596-
ProgrammingError: If the command ID is invalid
596+
ValueError: If the command ID is invalid
597597
"""
598598

599599
if command_id.backend_type != BackendType.SEA:

tests/unit/test_sea_backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def test_initialization(self, mock_http_client):
130130
assert client3.max_download_threads == 5
131131

132132
# Test with invalid HTTP path
133-
with pytest.raises(ProgrammingError) as excinfo:
133+
with pytest.raises(ValueError) as excinfo:
134134
SeaDatabricksClient(
135135
server_hostname="test-server.databricks.com",
136136
port=443,

0 commit comments

Comments
 (0)