From 2f702702276b849c7b222acb4ed4305a15a42425 Mon Sep 17 00:00:00 2001 From: James Greenhill Date: Mon, 15 Jul 2024 11:12:51 -0700 Subject: [PATCH] chore: Remove the kafka debug tables for now - they are too expensive and we are moving to kafka connect solution (#23538) --- .../0071_remove_kafka_debug_tables.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 posthog/clickhouse/migrations/0071_remove_kafka_debug_tables.py diff --git a/posthog/clickhouse/migrations/0071_remove_kafka_debug_tables.py b/posthog/clickhouse/migrations/0071_remove_kafka_debug_tables.py new file mode 100644 index 0000000000000..548ccadca55af --- /dev/null +++ b/posthog/clickhouse/migrations/0071_remove_kafka_debug_tables.py @@ -0,0 +1,20 @@ +from posthog.clickhouse.client.migration_tools import run_sql_with_exceptions +from posthog.kafka_client.topics import KAFKA_EVENTS_JSON +from posthog.models.kafka_debug.sql import ( + KafkaDebugTable, + KafkaDebugKafkaTable, + KafkaDebugMaterializedView, +) +from posthog.settings.data_stores import KAFKA_HOSTS + + +debug_table = KafkaDebugTable(topic=KAFKA_EVENTS_JSON) +kafka_table = KafkaDebugKafkaTable(brokers=KAFKA_HOSTS, topic=KAFKA_EVENTS_JSON) +materialized_view = KafkaDebugMaterializedView(to_table=debug_table, from_table=kafka_table) + + +operations = [ + run_sql_with_exceptions(kafka_table.get_drop_table_sql()), + run_sql_with_exceptions(materialized_view.get_drop_view_sql()), + run_sql_with_exceptions(debug_table.get_drop_table_sql()), +]