-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: change the serialization format from JSONEachRow to LineAsStri…
…ng for debug table (#23421)
- Loading branch information
1 parent
39a4d27
commit 49c79c0
Showing
4 changed files
with
37 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
23 changes: 23 additions & 0 deletions
23
posthog/clickhouse/migrations/0068_event_kafka_debug_line_as_string.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
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 = [ | ||
# We just need to drop and recreate the kafka and MV tables here to | ||
# correct the serialization type (LineAsString from JSONEachRow) | ||
run_sql_with_exceptions(kafka_table.get_drop_table_sql()), | ||
run_sql_with_exceptions(kafka_table.get_create_table_sql()), | ||
run_sql_with_exceptions(materialized_view.get_drop_view_sql()), | ||
run_sql_with_exceptions(materialized_view.get_create_view_sql()), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters