18
18
from databricks .sql import *
19
19
from databricks .sql .auth .authenticators import AuthProvider
20
20
from databricks .sql .backend .thrift_backend import ThriftDatabricksClient
21
+ from databricks .sql .result_set import ResultSet , ThriftResultSet
21
22
22
23
23
24
def retry_policy_factory ():
@@ -1146,7 +1147,10 @@ def test_execute_statement_calls_client_and_handle_execute_response(
1146
1147
thrift_backend ._handle_execute_response = Mock ()
1147
1148
cursor_mock = Mock ()
1148
1149
1149
- thrift_backend .execute_command ("foo" , Mock (), 100 , 200 , Mock (), cursor_mock )
1150
+ result = thrift_backend .execute_command ("foo" , Mock (), 100 , 200 , Mock (), cursor_mock )
1151
+ # Verify the result is a ResultSet
1152
+ self .assertIsInstance (result , ResultSet )
1153
+
1150
1154
# Check call to client
1151
1155
req = tcli_service_instance .ExecuteStatement .call_args [0 ][0 ]
1152
1156
get_direct_results = ttypes .TSparkGetDirectResults (maxRows = 100 , maxBytes = 200 )
@@ -1175,7 +1179,10 @@ def test_get_catalogs_calls_client_and_handle_execute_response(
1175
1179
thrift_backend ._handle_execute_response = Mock ()
1176
1180
cursor_mock = Mock ()
1177
1181
1178
- thrift_backend .get_catalogs (Mock (), 100 , 200 , cursor_mock )
1182
+ result = thrift_backend .get_catalogs (Mock (), 100 , 200 , cursor_mock )
1183
+ # Verify the result is a ResultSet
1184
+ self .assertIsInstance (result , ResultSet )
1185
+
1179
1186
# Check call to client
1180
1187
req = tcli_service_instance .GetCatalogs .call_args [0 ][0 ]
1181
1188
get_direct_results = ttypes .TSparkGetDirectResults (maxRows = 100 , maxBytes = 200 )
@@ -1203,14 +1210,17 @@ def test_get_schemas_calls_client_and_handle_execute_response(
1203
1210
thrift_backend ._handle_execute_response = Mock ()
1204
1211
cursor_mock = Mock ()
1205
1212
1206
- thrift_backend .get_schemas (
1213
+ result = thrift_backend .get_schemas (
1207
1214
Mock (),
1208
1215
100 ,
1209
1216
200 ,
1210
1217
cursor_mock ,
1211
1218
catalog_name = "catalog_pattern" ,
1212
1219
schema_name = "schema_pattern" ,
1213
1220
)
1221
+ # Verify the result is a ResultSet
1222
+ self .assertIsInstance (result , ResultSet )
1223
+
1214
1224
# Check call to client
1215
1225
req = tcli_service_instance .GetSchemas .call_args [0 ][0 ]
1216
1226
get_direct_results = ttypes .TSparkGetDirectResults (maxRows = 100 , maxBytes = 200 )
@@ -1240,7 +1250,7 @@ def test_get_tables_calls_client_and_handle_execute_response(
1240
1250
thrift_backend ._handle_execute_response = Mock ()
1241
1251
cursor_mock = Mock ()
1242
1252
1243
- thrift_backend .get_tables (
1253
+ result = thrift_backend .get_tables (
1244
1254
Mock (),
1245
1255
100 ,
1246
1256
200 ,
@@ -1250,6 +1260,9 @@ def test_get_tables_calls_client_and_handle_execute_response(
1250
1260
table_name = "table_pattern" ,
1251
1261
table_types = ["type1" , "type2" ],
1252
1262
)
1263
+ # Verify the result is a ResultSet
1264
+ self .assertIsInstance (result , ResultSet )
1265
+
1253
1266
# Check call to client
1254
1267
req = tcli_service_instance .GetTables .call_args [0 ][0 ]
1255
1268
get_direct_results = ttypes .TSparkGetDirectResults (maxRows = 100 , maxBytes = 200 )
@@ -1281,7 +1294,7 @@ def test_get_columns_calls_client_and_handle_execute_response(
1281
1294
thrift_backend ._handle_execute_response = Mock ()
1282
1295
cursor_mock = Mock ()
1283
1296
1284
- thrift_backend .get_columns (
1297
+ result = thrift_backend .get_columns (
1285
1298
Mock (),
1286
1299
100 ,
1287
1300
200 ,
@@ -1291,6 +1304,9 @@ def test_get_columns_calls_client_and_handle_execute_response(
1291
1304
table_name = "table_pattern" ,
1292
1305
column_name = "column_pattern" ,
1293
1306
)
1307
+ # Verify the result is a ResultSet
1308
+ self .assertIsInstance (result , ResultSet )
1309
+
1294
1310
# Check call to client
1295
1311
req = tcli_service_instance .GetColumns .call_args [0 ][0 ]
1296
1312
get_direct_results = ttypes .TSparkGetDirectResults (maxRows = 100 , maxBytes = 200 )
0 commit comments