@@ -252,7 +252,7 @@ def _get_time_hierarchy_values(
252
252
timeout : int ,
253
253
) -> Dict [str , Any ]:
254
254
"""Get values for time hierarchy columns."""
255
- result = {}
255
+ result : Dict [ str , Any ] = {}
256
256
current_time = datetime .now (timezone .utc )
257
257
258
258
# Set defaults from current time
@@ -323,7 +323,7 @@ def _get_date_column_values(
323
323
timeout : int ,
324
324
) -> Dict [str , Any ]:
325
325
"""Get values for date columns."""
326
- result = {}
326
+ result : Dict [ str , Any ] = {}
327
327
328
328
if not date_columns :
329
329
return result
@@ -418,7 +418,7 @@ def _get_remaining_column_values(
418
418
timeout : int ,
419
419
) -> Dict [str , Any ]:
420
420
"""Get values for remaining partition columns."""
421
- result = {}
421
+ result : Dict [ str , Any ] = {}
422
422
423
423
if not remaining_columns :
424
424
return result
@@ -563,7 +563,7 @@ def _extract_partitioning_from_ddl(
563
563
ddl_norm = ddl .replace ("\n " , " " ).replace ("\t " , " " ) # Preserve case
564
564
565
565
# Track found partition cols
566
- found_partition_cols = set ()
566
+ found_partition_cols : Set [ str ] = set ()
567
567
568
568
# Case 1: Standard PARTITION BY column
569
569
if "PARTITION BY" in ddl_upper :
@@ -606,7 +606,7 @@ def _extract_partitioning_from_ddl(
606
606
metadata ["partition_columns" ]["_PARTITIONTIME" ] = "TIMESTAMP"
607
607
608
608
def _extract_partition_by_clause (
609
- self , upper_clause : str , original_clause : str , found_partition_cols : set
609
+ self , upper_clause : str , original_clause : str , found_partition_cols : Set [ str ]
610
610
) -> None :
611
611
"""Extract partition columns from a PARTITION BY clause in DDL."""
612
612
try :
@@ -1184,7 +1184,7 @@ def _try_date_based_filtering_for_external(
1184
1184
"day" ,
1185
1185
):
1186
1186
# Try today, yesterday, last week, last month, etc.
1187
- test_dates = [
1187
+ test_dates_datetime = [
1188
1188
time_now ,
1189
1189
time_now - timedelta (days = 1 ),
1190
1190
time_now - timedelta (days = 7 ),
@@ -1194,7 +1194,7 @@ def _try_date_based_filtering_for_external(
1194
1194
datetime (time_now .year , 1 , 1 ), # First of year
1195
1195
]
1196
1196
1197
- for test_date in test_dates :
1197
+ for test_date in test_dates_datetime :
1198
1198
if col_type == "DATE" :
1199
1199
date_str = test_date .strftime ("%Y-%m-%d" )
1200
1200
filter_value = f"DATE '{ date_str } '"
@@ -1344,7 +1344,7 @@ def _get_external_table_partition_filters(
1344
1344
1345
1345
def _fetch_basic_table_metadata (self , table : BigqueryTable ) -> Dict [str , Any ]:
1346
1346
"""Get basic metadata from table object."""
1347
- metadata = {
1347
+ metadata : Dict [ str , Any ] = {
1348
1348
"partition_columns" : {},
1349
1349
"clustering_columns" : {},
1350
1350
"row_count" : table .rows_count ,
@@ -1493,7 +1493,7 @@ def _try_time_hierarchy_approach(
1493
1493
"""Helper method to try time hierarchy partitioning approach"""
1494
1494
# Time hierarchy columns in order of precedence
1495
1495
time_hierarchy_cols = ["year" , "month" , "day" , "hour" ]
1496
- hierarchy_filters = []
1496
+ hierarchy_filters : List [ str ] = []
1497
1497
1498
1498
# Build a filter using time hierarchy
1499
1499
time_now = datetime .now (timezone .utc )
@@ -2129,12 +2129,15 @@ def get_profile_request(
2129
2129
f"Using extended timeouts for very large table { profile_request .pretty_name } "
2130
2130
)
2131
2131
# Add extended query timeouts for very large tables
2132
- profile_request .profiler_config .update (
2133
- {
2134
- "query_timeout" : 300 , # 5 minutes
2135
- "chunk_size" : 5000 ,
2136
- }
2137
- )
2132
+ if hasattr (profile_request , "profiler_config" ):
2133
+ profile_request .profiler_config .update (
2134
+ {
2135
+ "query_timeout" : 300 , # 5 minutes
2136
+ "chunk_size" : 5000 ,
2137
+ }
2138
+ )
2139
+ else :
2140
+ logger .debug ("profiler_config not available on TableProfilerRequest" )
2138
2141
2139
2142
return profile_request
2140
2143
0 commit comments