42
42
)
43
43
from databricks .sql .types import SSLOptions
44
44
from databricks .sql .backend .databricks_client import DatabricksClient
45
+ from databricks .sql .result_set import ThriftResultSet
45
46
46
47
logger = logging .getLogger (__name__ )
47
48
@@ -833,7 +834,7 @@ def get_execution_result(self, op_handle, cursor):
833
834
ssl_options = self ._ssl_options ,
834
835
)
835
836
836
- return ExecuteResponse (
837
+ execute_response = ExecuteResponse (
837
838
arrow_queue = queue ,
838
839
status = resp .status ,
839
840
has_been_closed_server_side = False ,
@@ -844,6 +845,15 @@ def get_execution_result(self, op_handle, cursor):
844
845
description = description ,
845
846
arrow_schema_bytes = schema_bytes ,
846
847
)
848
+
849
+ return ThriftResultSet (
850
+ connection = cursor .connection ,
851
+ execute_response = execute_response ,
852
+ thrift_client = self ,
853
+ buffer_size_bytes = cursor .buffer_size_bytes ,
854
+ arraysize = cursor .arraysize ,
855
+ use_cloud_fetch = cursor .connection .use_cloud_fetch
856
+ )
847
857
848
858
def _wait_until_command_done (self , op_handle , initial_operation_status_resp ):
849
859
if initial_operation_status_resp :
@@ -938,8 +948,18 @@ def execute_command(
938
948
939
949
if async_op :
940
950
self ._handle_execute_response_async (resp , cursor )
951
+ return None
941
952
else :
942
- return self ._handle_execute_response (resp , cursor )
953
+ execute_response = self ._handle_execute_response (resp , cursor )
954
+
955
+ return ThriftResultSet (
956
+ connection = cursor .connection ,
957
+ execute_response = execute_response ,
958
+ thrift_client = self ,
959
+ buffer_size_bytes = max_bytes ,
960
+ arraysize = max_rows ,
961
+ use_cloud_fetch = use_cloud_fetch
962
+ )
943
963
944
964
def get_catalogs (self , session_handle , max_rows , max_bytes , cursor ):
945
965
assert session_handle is not None
@@ -951,7 +971,17 @@ def get_catalogs(self, session_handle, max_rows, max_bytes, cursor):
951
971
),
952
972
)
953
973
resp = self .make_request (self ._client .GetCatalogs , req )
954
- return self ._handle_execute_response (resp , cursor )
974
+
975
+ execute_response = self ._handle_execute_response (resp , cursor )
976
+
977
+ return ThriftResultSet (
978
+ connection = cursor .connection ,
979
+ execute_response = execute_response ,
980
+ thrift_client = self ,
981
+ buffer_size_bytes = max_bytes ,
982
+ arraysize = max_rows ,
983
+ use_cloud_fetch = cursor .connection .use_cloud_fetch
984
+ )
955
985
956
986
def get_schemas (
957
987
self ,
@@ -973,7 +1003,17 @@ def get_schemas(
973
1003
schemaName = schema_name ,
974
1004
)
975
1005
resp = self .make_request (self ._client .GetSchemas , req )
976
- return self ._handle_execute_response (resp , cursor )
1006
+
1007
+ execute_response = self ._handle_execute_response (resp , cursor )
1008
+
1009
+ return ThriftResultSet (
1010
+ connection = cursor .connection ,
1011
+ execute_response = execute_response ,
1012
+ thrift_client = self ,
1013
+ buffer_size_bytes = max_bytes ,
1014
+ arraysize = max_rows ,
1015
+ use_cloud_fetch = cursor .connection .use_cloud_fetch
1016
+ )
977
1017
978
1018
def get_tables (
979
1019
self ,
@@ -999,7 +1039,17 @@ def get_tables(
999
1039
tableTypes = table_types ,
1000
1040
)
1001
1041
resp = self .make_request (self ._client .GetTables , req )
1002
- return self ._handle_execute_response (resp , cursor )
1042
+
1043
+ execute_response = self ._handle_execute_response (resp , cursor )
1044
+
1045
+ return ThriftResultSet (
1046
+ connection = cursor .connection ,
1047
+ execute_response = execute_response ,
1048
+ thrift_client = self ,
1049
+ buffer_size_bytes = max_bytes ,
1050
+ arraysize = max_rows ,
1051
+ use_cloud_fetch = cursor .connection .use_cloud_fetch
1052
+ )
1003
1053
1004
1054
def get_columns (
1005
1055
self ,
@@ -1025,7 +1075,17 @@ def get_columns(
1025
1075
columnName = column_name ,
1026
1076
)
1027
1077
resp = self .make_request (self ._client .GetColumns , req )
1028
- return self ._handle_execute_response (resp , cursor )
1078
+
1079
+ execute_response = self ._handle_execute_response (resp , cursor )
1080
+
1081
+ return ThriftResultSet (
1082
+ connection = cursor .connection ,
1083
+ execute_response = execute_response ,
1084
+ thrift_client = self ,
1085
+ buffer_size_bytes = max_bytes ,
1086
+ arraysize = max_rows ,
1087
+ use_cloud_fetch = cursor .connection .use_cloud_fetch
1088
+ )
1029
1089
1030
1090
def _handle_execute_response (self , resp , cursor ):
1031
1091
cursor .active_op_handle = resp .operationHandle
0 commit comments