|
6 | 6 | import time |
7 | 7 | import threading |
8 | 8 | from typing import List, Optional, Union, Any, TYPE_CHECKING |
| 9 | +from uuid import UUID |
9 | 10 |
|
10 | 11 | from databricks.sql.result_set import ThriftResultSet |
11 | | - |
| 12 | +from databricks.sql.telemetry.models.event import StatementType |
12 | 13 |
|
13 | 14 | if TYPE_CHECKING: |
14 | 15 | from databricks.sql.client import Cursor |
@@ -900,6 +901,7 @@ def get_execution_result( |
900 | 901 | max_download_threads=self.max_download_threads, |
901 | 902 | ssl_options=self._ssl_options, |
902 | 903 | is_direct_results=is_direct_results, |
| 904 | + session_id_hex=self._session_id_hex, |
903 | 905 | ) |
904 | 906 |
|
905 | 907 | def _wait_until_command_done(self, op_handle, initial_operation_status_resp): |
@@ -1037,6 +1039,7 @@ def execute_command( |
1037 | 1039 | max_download_threads=self.max_download_threads, |
1038 | 1040 | ssl_options=self._ssl_options, |
1039 | 1041 | is_direct_results=is_direct_results, |
| 1042 | + session_id_hex=self._session_id_hex, |
1040 | 1043 | ) |
1041 | 1044 |
|
1042 | 1045 | def get_catalogs( |
@@ -1077,6 +1080,7 @@ def get_catalogs( |
1077 | 1080 | max_download_threads=self.max_download_threads, |
1078 | 1081 | ssl_options=self._ssl_options, |
1079 | 1082 | is_direct_results=is_direct_results, |
| 1083 | + session_id_hex=self._session_id_hex, |
1080 | 1084 | ) |
1081 | 1085 |
|
1082 | 1086 | def get_schemas( |
@@ -1123,6 +1127,7 @@ def get_schemas( |
1123 | 1127 | max_download_threads=self.max_download_threads, |
1124 | 1128 | ssl_options=self._ssl_options, |
1125 | 1129 | is_direct_results=is_direct_results, |
| 1130 | + session_id_hex=self._session_id_hex, |
1126 | 1131 | ) |
1127 | 1132 |
|
1128 | 1133 | def get_tables( |
@@ -1173,6 +1178,7 @@ def get_tables( |
1173 | 1178 | max_download_threads=self.max_download_threads, |
1174 | 1179 | ssl_options=self._ssl_options, |
1175 | 1180 | is_direct_results=is_direct_results, |
| 1181 | + session_id_hex=self._session_id_hex, |
1176 | 1182 | ) |
1177 | 1183 |
|
1178 | 1184 | def get_columns( |
@@ -1223,6 +1229,7 @@ def get_columns( |
1223 | 1229 | max_download_threads=self.max_download_threads, |
1224 | 1230 | ssl_options=self._ssl_options, |
1225 | 1231 | is_direct_results=is_direct_results, |
| 1232 | + session_id_hex=self._session_id_hex, |
1226 | 1233 | ) |
1227 | 1234 |
|
1228 | 1235 | def _handle_execute_response(self, resp, cursor): |
@@ -1257,6 +1264,7 @@ def fetch_results( |
1257 | 1264 | lz4_compressed: bool, |
1258 | 1265 | arrow_schema_bytes, |
1259 | 1266 | description, |
| 1267 | + chunk_id: int, |
1260 | 1268 | use_cloud_fetch=True, |
1261 | 1269 | ): |
1262 | 1270 | thrift_handle = command_id.to_thrift_handle() |
@@ -1294,9 +1302,16 @@ def fetch_results( |
1294 | 1302 | lz4_compressed=lz4_compressed, |
1295 | 1303 | description=description, |
1296 | 1304 | ssl_options=self._ssl_options, |
| 1305 | + session_id_hex=self._session_id_hex, |
| 1306 | + statement_id=command_id.to_hex_guid(), |
| 1307 | + chunk_id=chunk_id, |
1297 | 1308 | ) |
1298 | 1309 |
|
1299 | | - return queue, resp.hasMoreRows |
| 1310 | + return ( |
| 1311 | + queue, |
| 1312 | + resp.hasMoreRows, |
| 1313 | + len(resp.results.resultLinks) if resp.results.resultLinks else 0, |
| 1314 | + ) |
1300 | 1315 |
|
1301 | 1316 | def cancel_command(self, command_id: CommandId) -> None: |
1302 | 1317 | thrift_handle = command_id.to_thrift_handle() |
|
0 commit comments