18
18
from databricks .sql .exc import (
19
19
Error ,
20
20
NotSupportedError ,
21
+ ProgrammingError ,
21
22
ServerOperationError ,
22
23
DatabaseError ,
23
24
)
@@ -129,7 +130,7 @@ def test_initialization(self, mock_http_client):
129
130
assert client3 .max_download_threads == 5
130
131
131
132
# Test with invalid HTTP path
132
- with pytest .raises (ValueError ) as excinfo :
133
+ with pytest .raises (ProgrammingError ) as excinfo :
133
134
SeaDatabricksClient (
134
135
server_hostname = "test-server.databricks.com" ,
135
136
port = 443 ,
@@ -195,7 +196,7 @@ def test_session_management(self, sea_client, mock_http_client, thrift_session_i
195
196
)
196
197
197
198
# Test close_session with invalid ID type
198
- with pytest .raises (ValueError ) as excinfo :
199
+ with pytest .raises (ProgrammingError ) as excinfo :
199
200
sea_client .close_session (thrift_session_id )
200
201
assert "Not a valid SEA session ID" in str (excinfo .value )
201
202
@@ -244,7 +245,7 @@ def test_command_execution_sync(
244
245
assert cmd_id_arg .guid == "test-statement-123"
245
246
246
247
# Test with invalid session ID
247
- with pytest .raises (ValueError ) as excinfo :
248
+ with pytest .raises (ProgrammingError ) as excinfo :
248
249
mock_thrift_handle = MagicMock ()
249
250
mock_thrift_handle .sessionId .guid = b"guid"
250
251
mock_thrift_handle .sessionId .secret = b"secret"
@@ -452,7 +453,7 @@ def test_command_management(
452
453
)
453
454
454
455
# Test cancel_command with invalid ID
455
- with pytest .raises (ValueError ) as excinfo :
456
+ with pytest .raises (ProgrammingError ) as excinfo :
456
457
sea_client .cancel_command (thrift_command_id )
457
458
assert "Not a valid SEA command ID" in str (excinfo .value )
458
459
@@ -466,7 +467,7 @@ def test_command_management(
466
467
)
467
468
468
469
# Test close_command with invalid ID
469
- with pytest .raises (ValueError ) as excinfo :
470
+ with pytest .raises (ProgrammingError ) as excinfo :
470
471
sea_client .close_command (thrift_command_id )
471
472
assert "Not a valid SEA command ID" in str (excinfo .value )
472
473
@@ -525,7 +526,7 @@ def test_command_management(
525
526
assert result .status == CommandState .SUCCEEDED
526
527
527
528
# Test get_execution_result with invalid ID
528
- with pytest .raises (ValueError ) as excinfo :
529
+ with pytest .raises (ProgrammingError ) as excinfo :
529
530
sea_client .get_execution_result (thrift_command_id , mock_cursor )
530
531
assert "Not a valid SEA command ID" in str (excinfo .value )
531
532
@@ -721,7 +722,7 @@ def test_get_schemas(self, sea_client, sea_session_id, mock_cursor):
721
722
)
722
723
723
724
# Case 3: Without catalog name (should raise ValueError)
724
- with pytest .raises (ValueError ) as excinfo :
725
+ with pytest .raises (DatabaseError ) as excinfo :
725
726
sea_client .get_schemas (
726
727
session_id = sea_session_id ,
727
728
max_rows = 100 ,
@@ -872,7 +873,7 @@ def test_get_columns(self, sea_client, sea_session_id, mock_cursor):
872
873
)
873
874
874
875
# Case 3: Without catalog name (should raise ValueError)
875
- with pytest .raises (ValueError ) as excinfo :
876
+ with pytest .raises (DatabaseError ) as excinfo :
876
877
sea_client .get_columns (
877
878
session_id = sea_session_id ,
878
879
max_rows = 100 ,
0 commit comments