from db_con.connection import * from log import * def truncate_table(client, table_name: str) -> None: """ Truncate a ClickHouse table. """ query = f"TRUNCATE TABLE {table_name}" print(f"Truncating table: {table_name}") client.command(query) log.info(f"Table {table_name} truncated successfully.") def delete_rows(client, table_name: str, condition: str) -> None: """ Delete rows from a ClickHouse table based on a condition. """ query = f""" ALTER TABLE {table_name} DELETE WHERE {condition} """ print(f"Deleting rows from {table_name} where {condition}") client.command(query) log.info("Delete command submitted successfully.")