36 """!Filters and inserts a batch of records into ClickHouse.
38 Loads data from the Parquet file at DB_PATH, filters by BatchID,
39 and inserts the resulting records into the `benchmark.performance` table.
41 @param batch_id The BatchID to filter the dataset on.
43 @throws Exception If ClickHouse insert fails.
45 df = pl.read_parquet(DB_PATH)
46 df = df.filter(pl.col(
"BatchID") == batch_id)
49 df = safe_vector_cast(df, SCHEMA)
53 port=CLICKHOUSE_TCP_PORT,
55 password=CLICKHOUSE_PASSWORD
58 records = df.to_dicts()
61 client.execute(
"INSERT INTO benchmark.performance VALUES", records)
62 except Exception
as e:
63 print(f
"[ERROR] Error inserting records into ClickHouse: {e}")
66 print(f
"[INFO] Inserted {len(records)} records into ClickHouse for batch '{batch_id}'.")