5
5
import time
6
6
import uuid
7
7
import 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
9
12
10
- from databricks .sql .client import Cursor
11
13
from databricks .sql .thrift_api .TCLIService .ttypes import TOperationState
12
14
from databricks .sql .backend .types import (
13
15
SessionId ,
@@ -814,7 +816,7 @@ def _results_message_to_execute_response(self, resp, operation_state):
814
816
arrow_schema_bytes = schema_bytes ,
815
817
)
816
818
817
- def get_execution_result (self , command_id : CommandId , cursor ) :
819
+ def get_execution_result (self , command_id : CommandId , cursor : "Cursor" ) -> ExecuteResponse :
818
820
thrift_handle = command_id .to_thrift_handle ()
819
821
if not thrift_handle :
820
822
raise ValueError ("Not a valid Thrift command ID" )
@@ -930,7 +932,7 @@ def execute_command(
930
932
max_rows : int ,
931
933
max_bytes : int ,
932
934
lz4_compression : bool ,
933
- cursor : Cursor ,
935
+ cursor : " Cursor" ,
934
936
use_cloud_fetch = True ,
935
937
parameters = [],
936
938
async_op = False ,
@@ -988,7 +990,7 @@ def get_catalogs(
988
990
session_id : SessionId ,
989
991
max_rows : int ,
990
992
max_bytes : int ,
991
- cursor : Cursor ,
993
+ cursor : " Cursor" ,
992
994
) -> ExecuteResponse :
993
995
thrift_handle = session_id .to_thrift_handle ()
994
996
if not thrift_handle :
@@ -1008,7 +1010,7 @@ def get_schemas(
1008
1010
session_id : SessionId ,
1009
1011
max_rows : int ,
1010
1012
max_bytes : int ,
1011
- cursor : Cursor ,
1013
+ cursor : " Cursor" ,
1012
1014
catalog_name = None ,
1013
1015
schema_name = None ,
1014
1016
) -> ExecuteResponse :
@@ -1032,7 +1034,7 @@ def get_tables(
1032
1034
session_id : SessionId ,
1033
1035
max_rows : int ,
1034
1036
max_bytes : int ,
1035
- cursor : Cursor ,
1037
+ cursor : " Cursor" ,
1036
1038
catalog_name = None ,
1037
1039
schema_name = None ,
1038
1040
table_name = None ,
@@ -1060,7 +1062,7 @@ def get_columns(
1060
1062
session_id : SessionId ,
1061
1063
max_rows : int ,
1062
1064
max_bytes : int ,
1063
- cursor : Cursor ,
1065
+ cursor : " Cursor" ,
1064
1066
catalog_name = None ,
1065
1067
schema_name = None ,
1066
1068
table_name = None ,
0 commit comments