3737
3838
3939class TIMDEXDatasetMetadata :
40-
4140 def __init__ (self , timdex_dataset : "TIMDEXDataset" ) -> None :
4241 """Init TIMDEXDatasetMetadata.
4342
@@ -174,7 +173,7 @@ def _create_full_dataset_table(self, conn: DuckDBPyConnection) -> None:
174173 query = f"""
175174 create or replace table records as (
176175 select
177- { ',' .join (ORDERED_METADATA_COLUMN_NAMES )}
176+ { "," .join (ORDERED_METADATA_COLUMN_NAMES )}
178177 from read_parquet(
179178 '{ self .location } /data/records/**/*.parquet',
180179 hive_partitioning=true,
@@ -215,7 +214,7 @@ def _setup_metadata_schema(self) -> None:
215214
216215 logger .debug (
217216 "Metadata schema setup for TIMDEXDatasetMetadata, "
218- f"{ round (time .perf_counter ()- start_time ,2 )} s"
217+ f"{ round (time .perf_counter () - start_time , 2 )} s"
219218 )
220219
221220 def _attach_database_file (self , conn : DuckDBPyConnection ) -> None :
@@ -278,11 +277,11 @@ def _create_records_union_view(self, conn: DuckDBPyConnection) -> None:
278277 create or replace view metadata.records as
279278 (
280279 select
281- { ',' .join (ORDERED_METADATA_COLUMN_NAMES )}
280+ { "," .join (ORDERED_METADATA_COLUMN_NAMES )}
282281 from static_db.records
283282 union all
284283 select
285- { ',' .join (ORDERED_METADATA_COLUMN_NAMES )}
284+ { "," .join (ORDERED_METADATA_COLUMN_NAMES )}
286285 from metadata.append_deltas
287286 );
288287 """ )
@@ -380,10 +379,14 @@ def merge_append_deltas(self) -> None:
380379 s3_client = S3Client ()
381380
382381 # get filenames of append deltas
383- append_delta_filenames = self .conn .query ("""
382+ append_delta_filenames = (
383+ self .conn .query ("""
384384 select distinct(append_delta_filename)
385385 from metadata.append_deltas
386- """ ).to_df ()["append_delta_filename" ].to_list ()
386+ """ )
387+ .to_df ()["append_delta_filename" ]
388+ .to_list ()
389+ )
387390
388391 if len (append_delta_filenames ) == 0 :
389392 logger .info ("no append deltas found" )
@@ -408,7 +411,7 @@ def merge_append_deltas(self) -> None:
408411 self .conn .execute (f"""
409412 insert into local_static_db.records
410413 select
411- { ',' .join (ORDERED_METADATA_COLUMN_NAMES )}
414+ { "," .join (ORDERED_METADATA_COLUMN_NAMES )}
412415 from metadata.append_deltas
413416 """ )
414417
@@ -433,7 +436,7 @@ def merge_append_deltas(self) -> None:
433436
434437 logger .debug (
435438 "append deltas merged into the static metadata database file: "
436- f"{ self .metadata_database_path } , { time .perf_counter ()- start_time } s"
439+ f"{ self .metadata_database_path } , { time .perf_counter () - start_time } s"
437440 )
438441
439442 def write_append_delta_duckdb (self , filepath : str ) -> None :
@@ -451,13 +454,13 @@ def write_append_delta_duckdb(self, filepath: str) -> None:
451454
452455 # ensure s3:// schema prefix is present
453456 if self .location_scheme == "s3" :
454- filepath = f"s3://{ filepath .removeprefix (" s3://" )} "
457+ filepath = f"s3://{ filepath .removeprefix (' s3://' )} "
455458
456459 # perform query + write as one SQL statement
457460 sql = f"""
458461 copy (
459462 select
460- { ',' .join (ORDERED_METADATA_COLUMN_NAMES )}
463+ { "," .join (ORDERED_METADATA_COLUMN_NAMES )}
461464 from read_parquet(
462465 '{ filepath } ',
463466 hive_partitioning=true,
@@ -469,7 +472,7 @@ def write_append_delta_duckdb(self, filepath: str) -> None:
469472 self .conn .execute (sql )
470473
471474 logger .debug (
472- f"Append delta written: { output_path } , { time .perf_counter ()- start_time } s"
475+ f"Append delta written: { output_path } , { time .perf_counter () - start_time } s"
473476 )
474477
475478 def build_keyset_paginated_metadata_query (
0 commit comments