From 04ab552883a5a425f57c0462a0d11992bdc2e4b5 Mon Sep 17 00:00:00 2001 From: Carl Cervone <42869436+ccerv1@users.noreply.github.com> Date: Sun, 11 Aug 2024 13:57:33 -0400 Subject: [PATCH] feat: add superchain timeseries metrics to consolidated int models (#1937) --- .../intermediate/metrics/int_metrics.sql | 18 ++++++++++++++++++ .../int_timeseries_metrics_by_project.sql | 9 ++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/warehouse/dbt/models/intermediate/metrics/int_metrics.sql b/warehouse/dbt/models/intermediate/metrics/int_metrics.sql index d2b44560d..d47944da7 100644 --- a/warehouse/dbt/models/intermediate/metrics/int_metrics.sql +++ b/warehouse/dbt/models/intermediate/metrics/int_metrics.sql @@ -1,3 +1,9 @@ +{{ + config( + materialized='table' + ) +}} + select distinct {{ oso_id('"OSO"', '"oso"', 'metric') }} as metric_id, "OSO" as metric_source, @@ -21,3 +27,15 @@ select distinct "TODO" as definition_ref, "UNKNOWN" as aggregation_function from {{ ref('int_funding_metric__grants_received_usd') }} +union all +select distinct + {{ oso_id('"OSO"', '"oso"', 'metric', 'event_source') }} as metric_id, + "OSO" as metric_source, + "oso" as metric_namespace, + CONCAT(metric, "_", LOWER(event_source)) as metric_name, + "TODO" as display_name, + "TODO" as description, + null as raw_definition, + "TODO" as definition_ref, + "UNKNOWN" as aggregation_function +from {{ ref('int_timeseries_superchain_metrics__all') }} diff --git a/warehouse/dbt/models/intermediate/metrics/int_timeseries_metrics_by_project.sql b/warehouse/dbt/models/intermediate/metrics/int_timeseries_metrics_by_project.sql index 2be89ee47..cf32abd54 100644 --- a/warehouse/dbt/models/intermediate/metrics/int_timeseries_metrics_by_project.sql +++ b/warehouse/dbt/models/intermediate/metrics/int_timeseries_metrics_by_project.sql @@ -4,7 +4,6 @@ ) }} - select {{ oso_id('"OSO"', '"oso"', 'metric') }} as metric_id, metrics.project_id as project_id, @@ -20,3 +19,11 @@ select amount, unit from {{ ref('int_funding_metric__grants_received_usd') }} +union all +select + {{ oso_id('"OSO"', '"oso"', 'metric', 'event_source') }} as metric_id, + project_id, + sample_date, + amount, + unit +from {{ ref('int_timeseries_superchain_metrics__all') }}