55import time
66import uuid
77import threading
8- from typing import List , Union , Any
8+ from typing import List , Union , Any , TYPE_CHECKING
9+
10+ if TYPE_CHECKING :
11+ from databricks .sql .client import Cursor
912
10- from databricks .sql .client import Cursor
1113from databricks .sql .thrift_api .TCLIService .ttypes import TOperationState
1214from databricks .sql .backend .types import (
1315 SessionId ,
@@ -814,7 +816,7 @@ def _results_message_to_execute_response(self, resp, operation_state):
814816 arrow_schema_bytes = schema_bytes ,
815817 )
816818
817- def get_execution_result (self , command_id : CommandId , cursor ) :
819+ def get_execution_result (self , command_id : CommandId , cursor : "Cursor" ) -> ExecuteResponse :
818820 thrift_handle = command_id .to_thrift_handle ()
819821 if not thrift_handle :
820822 raise ValueError ("Not a valid Thrift command ID" )
@@ -930,7 +932,7 @@ def execute_command(
930932 max_rows : int ,
931933 max_bytes : int ,
932934 lz4_compression : bool ,
933- cursor : Cursor ,
935+ cursor : " Cursor" ,
934936 use_cloud_fetch = True ,
935937 parameters = [],
936938 async_op = False ,
@@ -988,7 +990,7 @@ def get_catalogs(
988990 session_id : SessionId ,
989991 max_rows : int ,
990992 max_bytes : int ,
991- cursor : Cursor ,
993+ cursor : " Cursor" ,
992994 ) -> ExecuteResponse :
993995 thrift_handle = session_id .to_thrift_handle ()
994996 if not thrift_handle :
@@ -1008,7 +1010,7 @@ def get_schemas(
10081010 session_id : SessionId ,
10091011 max_rows : int ,
10101012 max_bytes : int ,
1011- cursor : Cursor ,
1013+ cursor : " Cursor" ,
10121014 catalog_name = None ,
10131015 schema_name = None ,
10141016 ) -> ExecuteResponse :
@@ -1032,7 +1034,7 @@ def get_tables(
10321034 session_id : SessionId ,
10331035 max_rows : int ,
10341036 max_bytes : int ,
1035- cursor : Cursor ,
1037+ cursor : " Cursor" ,
10361038 catalog_name = None ,
10371039 schema_name = None ,
10381040 table_name = None ,
@@ -1060,7 +1062,7 @@ def get_columns(
10601062 session_id : SessionId ,
10611063 max_rows : int ,
10621064 max_bytes : int ,
1063- cursor : Cursor ,
1065+ cursor : " Cursor" ,
10641066 catalog_name = None ,
10651067 schema_name = None ,
10661068 table_name = None ,
0 commit comments