@@ -403,76 +403,14 @@ def fetchmany(self, size: int) -> List[Row]:
403403 @staticmethod
404404 def _get_schema_description (table_schema_message ):
405405 """
406- Initialize a SeaResultSet with the response from a SEA query execution.
407-
408- Args:
409- connection: The parent connection
410- sea_client: The SeaDatabricksClient instance for direct access
411- buffer_size_bytes: Buffer size for fetching results
412- arraysize: Default number of rows to fetch
413- execute_response: Response from the execute command (new style)
414- sea_response: Direct SEA response (legacy style)
415- """
416- # Handle both initialization styles
417- if execute_response is not None :
418- # New style with ExecuteResponse
419- command_id = execute_response .command_id
420- status = execute_response .status
421- has_been_closed_server_side = execute_response .has_been_closed_server_side
422- has_more_rows = execute_response .has_more_rows
423- results_queue = execute_response .results_queue
424- description = execute_response .description
425- is_staging_operation = execute_response .is_staging_operation
426- self ._response = getattr (execute_response , "sea_response" , {})
427- self .statement_id = command_id .to_sea_statement_id () if command_id else None
428- elif sea_response is not None :
429- # Legacy style with direct sea_response
430- self ._response = sea_response
431- # Extract values from sea_response
432- command_id = CommandId .from_sea_statement_id (
433- sea_response .get ("statement_id" , "" )
434- )
435- self .statement_id = sea_response .get ("statement_id" , "" )
436-
437- # Extract status
438- status_data = sea_response .get ("status" , {})
439- status = CommandState .from_sea_state (status_data .get ("state" , "PENDING" ))
440-
441- # Set defaults for other fields
442- has_been_closed_server_side = False
443- has_more_rows = False
444- results_queue = None
445- description = None
446- is_staging_operation = False
447- else :
448- raise ValueError ("Either execute_response or sea_response must be provided" )
449-
450- # Call parent constructor with common attributes
451- super ().__init__ (
452- connection = connection ,
453- backend = sea_client ,
454- arraysize = arraysize ,
455- buffer_size_bytes = buffer_size_bytes ,
456- command_id = command_id ,
457- status = status ,
458- has_been_closed_server_side = has_been_closed_server_side ,
459- has_more_rows = has_more_rows ,
460- results_queue = results_queue ,
461- description = description ,
462- is_staging_operation = is_staging_operation ,
463- )
464-
465- def _fill_results_buffer (self ):
466- """Fill the results buffer from the backend."""
467- raise NotImplementedError ("fetchone is not implemented for SEA backend" )
468-
469- def fetchone (self ) -> Optional [Row ]:
470- """
471- Fetch the next row of a query result set, returning a single sequence,
472- or None when no more data is available.
406+ Takes a TableSchema message and returns a description 7-tuple as specified by PEP-249
473407 """
474408
475- raise NotImplementedError ("fetchone is not implemented for SEA backend" )
409+ def map_col_type (type_ ):
410+ if type_ .startswith ("decimal" ):
411+ return "decimal"
412+ else :
413+ return type_
476414
477415 return [
478416 (column .name , map_col_type (column .datatype ), None , None , None , None , None )
0 commit comments