2727 BackendType ,
2828 ExecuteResponse ,
2929)
30- from databricks .sql .exc import DatabaseError , ServerOperationError
30+ from databricks .sql .exc import DatabaseError , ProgrammingError , ServerOperationError
3131from databricks .sql .backend .sea .utils .http_client import SeaHttpClient
3232from databricks .sql .types import SSLOptions
3333
@@ -172,7 +172,7 @@ def _extract_warehouse_id(self, http_path: str) -> str:
172172 f"Note: SEA only works for warehouses."
173173 )
174174 logger .error (error_message )
175- raise ValueError (error_message )
175+ raise ProgrammingError (error_message )
176176
177177 @property
178178 def max_download_threads (self ) -> int :
@@ -244,14 +244,14 @@ def close_session(self, session_id: SessionId) -> None:
244244 session_id: The session identifier returned by open_session()
245245
246246 Raises:
247- ValueError : If the session ID is invalid
247+ ProgrammingError : If the session ID is invalid
248248 OperationalError: If there's an error closing the session
249249 """
250250
251251 logger .debug ("SeaDatabricksClient.close_session(session_id=%s)" , session_id )
252252
253253 if session_id .backend_type != BackendType .SEA :
254- raise ValueError ("Not a valid SEA session ID" )
254+ raise ProgrammingError ("Not a valid SEA session ID" )
255255 sea_session_id = session_id .to_sea_session_id ()
256256
257257 request_data = DeleteSessionRequest (
@@ -429,7 +429,7 @@ def execute_command(
429429 """
430430
431431 if session_id .backend_type != BackendType .SEA :
432- raise ValueError ("Not a valid SEA session ID" )
432+ raise ProgrammingError ("Not a valid SEA session ID" )
433433
434434 sea_session_id = session_id .to_sea_session_id ()
435435
@@ -504,11 +504,11 @@ def cancel_command(self, command_id: CommandId) -> None:
504504 command_id: Command identifier to cancel
505505
506506 Raises:
507- ValueError : If the command ID is invalid
507+ ProgrammingError : If the command ID is invalid
508508 """
509509
510510 if command_id .backend_type != BackendType .SEA :
511- raise ValueError ("Not a valid SEA command ID" )
511+ raise ProgrammingError ("Not a valid SEA command ID" )
512512
513513 sea_statement_id = command_id .to_sea_statement_id ()
514514
@@ -527,11 +527,11 @@ def close_command(self, command_id: CommandId) -> None:
527527 command_id: Command identifier to close
528528
529529 Raises:
530- ValueError : If the command ID is invalid
530+ ProgrammingError : If the command ID is invalid
531531 """
532532
533533 if command_id .backend_type != BackendType .SEA :
534- raise ValueError ("Not a valid SEA command ID" )
534+ raise ProgrammingError ("Not a valid SEA command ID" )
535535
536536 sea_statement_id = command_id .to_sea_statement_id ()
537537
@@ -553,7 +553,7 @@ def get_query_state(self, command_id: CommandId) -> CommandState:
553553 CommandState: The current state of the command
554554
555555 Raises:
556- ValueError : If the command ID is invalid
556+ ProgrammingError : If the command ID is invalid
557557 """
558558
559559 if command_id .backend_type != BackendType .SEA :
@@ -592,7 +592,7 @@ def get_execution_result(
592592 """
593593
594594 if command_id .backend_type != BackendType .SEA :
595- raise ValueError ("Not a valid SEA command ID" )
595+ raise ProgrammingError ("Not a valid SEA command ID" )
596596
597597 sea_statement_id = command_id .to_sea_statement_id ()
598598
@@ -658,7 +658,7 @@ def get_schemas(
658658 ) -> SeaResultSet :
659659 """Get schemas by executing 'SHOW SCHEMAS IN catalog [LIKE pattern]'."""
660660 if not catalog_name :
661- raise ValueError ("Catalog name is required for get_schemas" )
661+ raise DatabaseError ("Catalog name is required for get_schemas" )
662662
663663 operation = MetadataCommands .SHOW_SCHEMAS .value .format (catalog_name )
664664
@@ -740,7 +740,7 @@ def get_columns(
740740 ) -> SeaResultSet :
741741 """Get columns by executing 'SHOW COLUMNS IN CATALOG catalog [SCHEMA LIKE pattern] [TABLE LIKE pattern] [LIKE pattern]'."""
742742 if not catalog_name :
743- raise ValueError ("Catalog name is required for get_columns" )
743+ raise DatabaseError ("Catalog name is required for get_columns" )
744744
745745 operation = MetadataCommands .SHOW_COLUMNS .value .format (catalog_name )
746746
0 commit comments