1
1
import logging
2
2
import time
3
- from typing import Optional , Union
3
+ from typing import Optional
4
4
5
5
from databricks .sdk import WorkspaceClient
6
6
from databricks .sdk .core import DatabricksError
7
7
from databricks .sdk .service ._internal import Wait
8
8
from databricks .sdk .service .catalog import TableInfo
9
9
from databricks .sdk .service .sql import (
10
- ExecuteStatementResponse ,
11
- GetStatementResponse ,
12
10
GetWarehouseResponse ,
11
+ StatementResponse ,
13
12
StatementState ,
14
13
StatementStatus ,
15
14
)
@@ -125,7 +124,7 @@ def _should_retry_unsupported_column(
125
124
126
125
def _analyze_table (
127
126
self , ref : TableReference , include_columns : bool
128
- ) -> ExecuteStatementResponse :
127
+ ) -> StatementResponse :
129
128
statement = f"ANALYZE TABLE { ref .schema } .{ ref .table } COMPUTE STATISTICS"
130
129
if include_columns :
131
130
statement += " FOR ALL COLUMNS"
@@ -139,7 +138,7 @@ def _analyze_table(
139
138
return response
140
139
141
140
def _check_analyze_table_statement_status (
142
- self , execute_response : ExecuteStatementResponse , max_wait_secs : int
141
+ self , execute_response : StatementResponse , max_wait_secs : int
143
142
) -> bool :
144
143
if not execute_response .statement_id or not execute_response .status :
145
144
return False
@@ -230,9 +229,7 @@ def _get_int(self, table_info: TableInfo, field: str) -> Optional[int]:
230
229
return None
231
230
232
231
@staticmethod
233
- def _raise_if_error (
234
- response : Union [ExecuteStatementResponse , GetStatementResponse ], key : str
235
- ) -> None :
232
+ def _raise_if_error (response : StatementResponse , key : str ) -> None :
236
233
if response .status and response .status .state in [
237
234
StatementState .FAILED ,
238
235
StatementState .CANCELED ,
0 commit comments