From 7695310b0093a885930671f12356ae67193dd450 Mon Sep 17 00:00:00 2001 From: Raymond Cheng Date: Tue, 6 Aug 2024 07:11:31 -0700 Subject: [PATCH] fix: Copy metrics to Clickhouse (#1920) * Set the timeseries_metrics to be copied to Clickhouse * Fix a bug for duplicate values in metrics_v0 --- .../dbt/models/intermediate/metrics/int_metrics.sql | 2 +- .../metrics/timeseries_metrics_by_artifact_v0.sql | 10 ++++++++++ .../marts/metrics/timeseries_metrics_by_project_v0.sql | 10 ++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/warehouse/dbt/models/intermediate/metrics/int_metrics.sql b/warehouse/dbt/models/intermediate/metrics/int_metrics.sql index 8a226f1f4..031edd8c8 100644 --- a/warehouse/dbt/models/intermediate/metrics/int_metrics.sql +++ b/warehouse/dbt/models/intermediate/metrics/int_metrics.sql @@ -1,4 +1,4 @@ -select +select distinct {{ oso_id('"OSO"', '"oso"', 'metric') }} as metric_id, "OSO" as metric_source, "oso" as metric_namespace, diff --git a/warehouse/dbt/models/marts/metrics/timeseries_metrics_by_artifact_v0.sql b/warehouse/dbt/models/marts/metrics/timeseries_metrics_by_artifact_v0.sql index a37b1cfe3..5d19b3743 100644 --- a/warehouse/dbt/models/marts/metrics/timeseries_metrics_by_artifact_v0.sql +++ b/warehouse/dbt/models/marts/metrics/timeseries_metrics_by_artifact_v0.sql @@ -1,3 +1,13 @@ +{{ + config(meta = { + 'sync_to_db': True, + 'index': { + 'idx_metric_id': ["metric_id"], + 'idx_artifact_id': ["artifact_id"], + } + }) +}} + select metric_id, artifact_id, diff --git a/warehouse/dbt/models/marts/metrics/timeseries_metrics_by_project_v0.sql b/warehouse/dbt/models/marts/metrics/timeseries_metrics_by_project_v0.sql index 7dcd116fe..f0fd96b5e 100644 --- a/warehouse/dbt/models/marts/metrics/timeseries_metrics_by_project_v0.sql +++ b/warehouse/dbt/models/marts/metrics/timeseries_metrics_by_project_v0.sql @@ -1,3 +1,13 @@ +{{ + config(meta = { + 'sync_to_db': True, + 'index': { + 'idx_metric_id': ["metric_id"], + 'idx_project_id': ["project_id"], + } + }) +}} + select metric_id, project_id,