1616from .utilities import databricksify_inst_name , SchemaType
1717from typing import List , Any , Dict , IO , cast , Optional
1818from fastapi import HTTPException
19- import json
20- import time
2119import requests
2220
2321try :
@@ -347,11 +345,19 @@ def fetch_table_data(
347345 # No client-side polling; require SUCCEEDED within 30s.
348346 if not resp .status or resp .status .state != "SUCCEEDED" :
349347 state = resp .status .state if resp .status else "UNKNOWN"
350- msg = resp .status .error .message if (resp .status and resp .status .error ) else "Query not finished within wait_timeout"
351- raise TimeoutError (f"Statement { stmt_id } not finished (state={ state } ): { msg } " )
348+ msg = (
349+ resp .status .error .message
350+ if (resp .status and resp .status .error )
351+ else "Query not finished within wait_timeout"
352+ )
353+ raise TimeoutError (
354+ f"Statement { stmt_id } not finished (state={ state } ): { msg } "
355+ )
352356
353357 # Columns (ensure List[str] for type-checkers)
354- if not (resp .manifest and resp .manifest .schema and resp .manifest .schema .columns ):
358+ if not (
359+ resp .manifest and resp .manifest .schema and resp .manifest .schema .columns
360+ ):
355361 raise ValueError ("Schema/columns missing (EXTERNAL_LINKS)." )
356362 cols : List [str ] = []
357363 for c in resp .manifest .schema .columns :
@@ -375,7 +381,9 @@ def _consume_chunk(chunk_obj: Any) -> int | None:
375381 r .raise_for_status ()
376382 rows = r .json ()
377383 if not isinstance (rows , list ):
378- raise ValueError ("Unexpected external link payload (expected JSON array)." )
384+ raise ValueError (
385+ "Unexpected external link payload (expected JSON array)."
386+ )
379387 for row in rows :
380388 if not isinstance (row , list ):
381389 raise ValueError ("Unexpected row shape (expected list)." )
@@ -397,7 +405,6 @@ def _consume_chunk(chunk_obj: Any) -> int | None:
397405
398406 return records
399407
400-
401408 def get_key_for_file (
402409 self , mapping : Dict [str , Any ], file_name : str
403410 ) -> Optional [str ]:
0 commit comments