-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: create ClickHouse override tables #25681
Conversation
KAFKA_ERROR_TRACKING_ISSUE_FINGERPRINT_OVERRIDES_TABLE_SQL = ( | ||
lambda: ERROR_TRACKING_ISSUE_FINGERPRINT_OVERRIDES_TABLE_BASE_SQL.format( | ||
table_name="kafka_" + ERROR_TRACKING_ISSUE_FINGERPRINT_OVERRIDES_TABLE, | ||
cluster=CLICKHOUSE_CLUSTER, | ||
engine=kafka_engine( | ||
KAFKA_ERROR_TRACKING_ISSUE_FINGERPRINT, group="clickhouse-error-tracking-issue-fingerprint-overrides" | ||
), | ||
extra_fields="", | ||
) | ||
) | ||
|
||
ERROR_TRACKING_ISSUE_FINGERPRINT_OVERRIDES_MV_SQL = """ | ||
CREATE MATERIALIZED VIEW IF NOT EXISTS {table_name}_mv ON CLUSTER '{cluster}' | ||
TO {database}.{table_name} | ||
AS SELECT | ||
team_id, | ||
fingerprint, | ||
issue_id, | ||
is_deleted, | ||
version, | ||
_timestamp, | ||
_offset, | ||
_partition | ||
FROM {database}.kafka_{table_name} | ||
WHERE version > 0 -- only store updated rows, not newly inserted ones | ||
""".format( | ||
table_name=ERROR_TRACKING_ISSUE_FINGERPRINT_OVERRIDES_TABLE, | ||
cluster=CLICKHOUSE_CLUSTER, | ||
database=CLICKHOUSE_DATABASE, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't see where either of these two tables were being used for persons distinct id overrides... Is it legacy or necessary part of the table setup in CH? @tkaemming
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are both necessary — you'll want to only issue read requests against the error_tracking_issue_fingerprint_overrides
table and use the Kafka topic (and table) added here to handle writing to the table versus running INSERT
/UPDATE
s manually. The Kafka table handles the Kafka consumer side, and the materialized view shuttles data from the Kafka table to the data table when there are rows ready to be written.
…posthog into dn-feat/create-overrides-tables
Problem
Related to https://github.com/PostHog/product-internal/pull/662
Changes
We have decided to use the same overrides pattern as person distinct ids. This copies all the work done there to create the necessary tables in ClickHouse