1919if TYPE_CHECKING :
2020 from databricks .sql .client import Cursor
2121
22- from databricks .sql .backend . sea . result_set import SeaResultSet
22+ from databricks .sql .result_set import SeaResultSet
2323
2424from databricks .sql .backend .databricks_client import DatabricksClient
2525from databricks .sql .backend .types import (
2929 BackendType ,
3030 ExecuteResponse ,
3131)
32- from databricks .sql .exc import DatabaseError , ProgrammingError , ServerOperationError
32+ from databricks .sql .exc import DatabaseError , ServerOperationError
3333from databricks .sql .backend .sea .utils .http_client import SeaHttpClient
3434from databricks .sql .types import SSLOptions
3535
@@ -135,7 +135,7 @@ def __init__(
135135 self .warehouse_id = self ._extract_warehouse_id (http_path )
136136
137137 # Initialize HTTP client
138- self .http_client = SeaHttpClient (
138+ self ._http_client = SeaHttpClient (
139139 server_hostname = server_hostname ,
140140 port = port ,
141141 http_path = http_path ,
@@ -180,7 +180,7 @@ def _extract_warehouse_id(self, http_path: str) -> str:
180180 f"Note: SEA only works for warehouses."
181181 )
182182 logger .error (error_message )
183- raise ProgrammingError (error_message )
183+ raise ValueError (error_message )
184184
185185 @property
186186 def max_download_threads (self ) -> int :
@@ -227,7 +227,7 @@ def open_session(
227227 schema = schema ,
228228 )
229229
230- response = self .http_client ._make_request (
230+ response = self ._http_client ._make_request (
231231 method = "POST" , path = self .SESSION_PATH , data = request_data .to_dict ()
232232 )
233233
@@ -252,22 +252,22 @@ def close_session(self, session_id: SessionId) -> None:
252252 session_id: The session identifier returned by open_session()
253253
254254 Raises:
255- ProgrammingError : If the session ID is invalid
255+ ValueError : If the session ID is invalid
256256 OperationalError: If there's an error closing the session
257257 """
258258
259259 logger .debug ("SeaDatabricksClient.close_session(session_id=%s)" , session_id )
260260
261261 if session_id .backend_type != BackendType .SEA :
262- raise ProgrammingError ("Not a valid SEA session ID" )
262+ raise ValueError ("Not a valid SEA session ID" )
263263 sea_session_id = session_id .to_sea_session_id ()
264264
265265 request_data = DeleteSessionRequest (
266266 warehouse_id = self .warehouse_id ,
267267 session_id = sea_session_id ,
268268 )
269269
270- self .http_client ._make_request (
270+ self ._http_client ._make_request (
271271 method = "DELETE" ,
272272 path = self .SESSION_PATH_WITH_ID .format (sea_session_id ),
273273 data = request_data .to_dict (),
@@ -462,7 +462,7 @@ def execute_command(
462462 """
463463
464464 if session_id .backend_type != BackendType .SEA :
465- raise ProgrammingError ("Not a valid SEA session ID" )
465+ raise ValueError ("Not a valid SEA session ID" )
466466
467467 sea_session_id = session_id .to_sea_session_id ()
468468
@@ -509,7 +509,7 @@ def execute_command(
509509 result_compression = result_compression ,
510510 )
511511
512- response_data = self .http_client ._make_request (
512+ response_data = self ._http_client ._make_request (
513513 method = "POST" , path = self .STATEMENT_PATH , data = request .to_dict ()
514514 )
515515 response = ExecuteStatementResponse .from_dict (response_data )
@@ -546,16 +546,16 @@ def cancel_command(self, command_id: CommandId) -> None:
546546 command_id: Command identifier to cancel
547547
548548 Raises:
549- ProgrammingError : If the command ID is invalid
549+ ValueError : If the command ID is invalid
550550 """
551551
552552 if command_id .backend_type != BackendType .SEA :
553- raise ProgrammingError ("Not a valid SEA command ID" )
553+ raise ValueError ("Not a valid SEA command ID" )
554554
555555 sea_statement_id = command_id .to_sea_statement_id ()
556556
557557 request = CancelStatementRequest (statement_id = sea_statement_id )
558- self .http_client ._make_request (
558+ self ._http_client ._make_request (
559559 method = "POST" ,
560560 path = self .CANCEL_STATEMENT_PATH_WITH_ID .format (sea_statement_id ),
561561 data = request .to_dict (),
@@ -569,16 +569,16 @@ def close_command(self, command_id: CommandId) -> None:
569569 command_id: Command identifier to close
570570
571571 Raises:
572- ProgrammingError : If the command ID is invalid
572+ ValueError : If the command ID is invalid
573573 """
574574
575575 if command_id .backend_type != BackendType .SEA :
576- raise ProgrammingError ("Not a valid SEA command ID" )
576+ raise ValueError ("Not a valid SEA command ID" )
577577
578578 sea_statement_id = command_id .to_sea_statement_id ()
579579
580580 request = CloseStatementRequest (statement_id = sea_statement_id )
581- self .http_client ._make_request (
581+ self ._http_client ._make_request (
582582 method = "DELETE" ,
583583 path = self .STATEMENT_PATH_WITH_ID .format (sea_statement_id ),
584584 data = request .to_dict (),
@@ -595,7 +595,7 @@ def _poll_query(self, command_id: CommandId) -> GetStatementResponse:
595595 sea_statement_id = command_id .to_sea_statement_id ()
596596
597597 request = GetStatementRequest (statement_id = sea_statement_id )
598- response_data = self .http_client ._make_request (
598+ response_data = self ._http_client ._make_request (
599599 method = "GET" ,
600600 path = self .STATEMENT_PATH_WITH_ID .format (sea_statement_id ),
601601 data = request .to_dict (),
@@ -615,7 +615,7 @@ def get_query_state(self, command_id: CommandId) -> CommandState:
615615 CommandState: The current state of the command
616616
617617 Raises:
618- ProgrammingError : If the command ID is invalid
618+ ValueError : If the command ID is invalid
619619 """
620620
621621 response = self ._poll_query (command_id )
@@ -643,27 +643,6 @@ def get_execution_result(
643643 response = self ._poll_query (command_id )
644644 return self ._response_to_result_set (response , cursor )
645645
646- def get_chunk_links (
647- self , statement_id : str , chunk_index : int
648- ) -> List [ExternalLink ]:
649- """
650- Get links for chunks starting from the specified index.
651- Args:
652- statement_id: The statement ID
653- chunk_index: The starting chunk index
654- Returns:
655- ExternalLink: External link for the chunk
656- """
657-
658- response_data = self ._http_client ._make_request (
659- method = "GET" ,
660- path = self .CHUNK_PATH_WITH_ID_AND_INDEX .format (statement_id , chunk_index ),
661- )
662- response = GetChunksResponse .from_dict (response_data )
663-
664- links = response .external_links or []
665- return links
666-
667646 # == Metadata Operations ==
668647
669648 def get_catalogs (
0 commit comments