From ea2ad740a766a104205275cd1b7b53c03a7e665f Mon Sep 17 00:00:00 2001 From: Marlene Hirose <92952117+Marlene-M-Hirose@users.noreply.github.com> Date: Fri, 13 Sep 2024 09:30:38 -0700 Subject: [PATCH] Desktop_retention_aggregates_v2 changes the data source from clients_first_seen_v2 to v3 as well as adding distribution_id to table (#6199) --- .../metadata.yaml | 26 +++++ .../desktop_retention_aggregates_v2/query.sql | 50 +++++++++ .../schema.yaml | 101 ++++++++++++++++++ 3 files changed, 177 insertions(+) create mode 100644 sql/moz-fx-data-shared-prod/telemetry_derived/desktop_retention_aggregates_v2/metadata.yaml create mode 100644 sql/moz-fx-data-shared-prod/telemetry_derived/desktop_retention_aggregates_v2/query.sql create mode 100644 sql/moz-fx-data-shared-prod/telemetry_derived/desktop_retention_aggregates_v2/schema.yaml diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_retention_aggregates_v2/metadata.yaml b/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_retention_aggregates_v2/metadata.yaml new file mode 100644 index 0000000000..cc13505e50 --- /dev/null +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_retention_aggregates_v2/metadata.yaml @@ -0,0 +1,26 @@ +friendly_name: Desktop Retention - Aggregate +description: |- + Desktop Retention Aggregated +owners: +- mhirose@mozilla.com +labels: + incremental: true + owner1: example +scheduling: + dag_name: bqetl_desktop_retention_model + date_partition_parameter: metric_date + date_partition_offset: -27 + parameters: + - submission_date:DATE:{{ds}} +bigquery: + time_partitioning: + type: day + field: 'metric_date' + require_partition_filter: false + expiration_days: null + range_partitioning: null + clustering: + fields: + - country + - normalized_os +references: {} diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_retention_aggregates_v2/query.sql b/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_retention_aggregates_v2/query.sql new file mode 100644 index 0000000000..1c5c7e44ab --- /dev/null +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_retention_aggregates_v2/query.sql @@ -0,0 +1,50 @@ +SELECT + metric_date, + first_seen_date, + normalized_channel, + country, + app_version, + locale, + attribution_campaign, + attribution_content, + attribution_dlsource, + attribution_medium, + attribution_ua, + attribution_experiment, + attribution_variation, + distribution_id, + startup_profile_selection_reason, + normalized_os, + normalized_os_version, + is_desktop, + COUNTIF(ping_sent_metric_date) AS ping_sent_metric_date, + COUNTIF(ping_sent_week_4) AS ping_sent_week_4, + COUNTIF(active_metric_date) AS active_metric_date, + COUNTIF(retained_week_4) AS retained_week_4, + COUNTIF(retained_week_4_new_profile) AS retained_week_4_new_profiles, + COUNTIF(new_profile_metric_date) AS new_profiles_metric_date, + COUNTIF(repeat_profile) AS repeat_profiles, +FROM + `moz-fx-data-shared-prod.telemetry_derived.desktop_retention_clients_v2` +WHERE + metric_date = DATE_SUB(@submission_date, INTERVAL 27 DAY) + AND submission_date = @submission_date +GROUP BY + metric_date, + first_seen_date, + normalized_channel, + country, + app_version, + locale, + attribution_campaign, + attribution_content, + attribution_dlsource, + attribution_medium, + attribution_ua, + attribution_experiment, + attribution_variation, + distribution_id, + startup_profile_selection_reason, + normalized_os, + normalized_os_version, + is_desktop diff --git a/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_retention_aggregates_v2/schema.yaml b/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_retention_aggregates_v2/schema.yaml new file mode 100644 index 0000000000..5a5b88fd51 --- /dev/null +++ b/sql/moz-fx-data-shared-prod/telemetry_derived/desktop_retention_aggregates_v2/schema.yaml @@ -0,0 +1,101 @@ +fields: +- mode: NULLABLE + name: metric_date + type: DATE + description: Metric DAte +- mode: NULLABLE + name: first_seen_date + type: DATE + description: First Seen Date +- mode: NULLABLE + name: normalized_channel + type: STRING + description: Normalized Channel +- mode: NULLABLE + name: country + type: STRING + description: Country +- mode: NULLABLE + name: app_version + type: STRING + description: App Version +- mode: NULLABLE + name: locale + type: STRING + description: Locale +- mode: NULLABLE + name: attribution_campaign + type: STRING + description: Attribution Campaign +- mode: NULLABLE + name: attribution_content + type: STRING + description: Attribution Content +- mode: NULLABLE + name: attribution_dlsource + type: STRING + description: Attribution DL Source +- mode: NULLABLE + name: attribution_medium + type: STRING + description: Attribution Medium +- mode: NULLABLE + name: attribution_ua + type: STRING + description: Attribution UA +- mode: NULLABLE + name: attribution_experiment + type: STRING + description: Attribution Experiment +- mode: NULLABLE + name: attribution_variation + type: STRING + description: Attribution Variation +- mode: NULLABLE + name: distribution_id + type: STRING + description: Distribution ID +- mode: NULLABLE + name: startup_profile_selection_reason + type: STRING + description: Startup Profile Selection Reason +- mode: NULLABLE + name: normalized_os + type: STRING + description: Normalized OS +- mode: NULLABLE + name: normalized_os_version + type: STRING + description: Normalized OS Version +- mode: NULLABLE + name: is_desktop + type: BOOLEAN + description: Indicates if the client is included in the desktop KPI +- mode: NULLABLE + name: ping_sent_metric_date + type: INT64 + description: Count of Pings Sent on Metric Date +- mode: NULLABLE + name: ping_sent_week_4 + type: INT64 + description: Count of Pings Sent on Week 4 +- mode: NULLABLE + name: active_metric_date + type: INT64 + description: Count of Clients Active on Metric Date +- mode: NULLABLE + name: retained_week_4 + type: INT64 + description: Count of Clients Retained on Week 4 +- mode: NULLABLE + name: retained_week_4_new_profiles + type: INT64 + description: Count of New Profiles Retained on Week 4 +- mode: NULLABLE + name: new_profiles_metric_date + type: INT64 + description: Count of New Profiles on Metric Date +- mode: NULLABLE + name: repeat_profiles + type: INT64 + description: Count of Repeat Profiles