first commit

This commit is contained in:
Ankit Malik
2026-06-12 10:54:00 +05:30
commit 7fbbffec65
17 changed files with 2057 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
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.")