diff --git a/sql/moz-fx-data-shared-prod/subscription_platform_backend_cirrus/delete_events/view.sql b/sql/moz-fx-data-shared-prod/subscription_platform_backend_cirrus/delete_events/view.sql index 8d0f4906c9f..12aba0b95f7 100644 --- a/sql/moz-fx-data-shared-prod/subscription_platform_backend_cirrus/delete_events/view.sql +++ b/sql/moz-fx-data-shared-prod/subscription_platform_backend_cirrus/delete_events/view.sql @@ -5,3 +5,8 @@ SELECT * FROM `moz-fx-data-shared-prod.subscription_platform_backend_cirrus_derived.delete_events_v1` +UNION ALL +SELECT + * +FROM + `moz-fx-data-shared-prod.subscription_platform_backend_cirrus_derived.delete_events_v2` diff --git a/sql/moz-fx-data-shared-prod/subscription_platform_backend_cirrus_derived/delete_events_v2/metadata.yaml b/sql/moz-fx-data-shared-prod/subscription_platform_backend_cirrus_derived/delete_events_v2/metadata.yaml new file mode 100644 index 00000000000..8dda79fcdb7 --- /dev/null +++ b/sql/moz-fx-data-shared-prod/subscription_platform_backend_cirrus_derived/delete_events_v2/metadata.yaml @@ -0,0 +1,18 @@ +--- +friendly_name: Subscription Platform Backend Cirrus Delete Events +description: Deletion events for subscription platform backend cirrus, derived + from payments-api GKE logs containing pre-derived nimbus_user_id +owners: + - dalvarez@mozilla.com +labels: + incremental: true + schedule: daily + table_type: client_level +scheduling: + dag_name: bqetl_fxa_events +bigquery: + time_partitioning: + type: day + field: submission_timestamp + require_partition_filter: false + require_column_description: true diff --git a/sql/moz-fx-data-shared-prod/subscription_platform_backend_cirrus_derived/delete_events_v2/query.sql b/sql/moz-fx-data-shared-prod/subscription_platform_backend_cirrus_derived/delete_events_v2/query.sql new file mode 100644 index 00000000000..8d394f404e5 --- /dev/null +++ b/sql/moz-fx-data-shared-prod/subscription_platform_backend_cirrus_derived/delete_events_v2/query.sql @@ -0,0 +1,16 @@ +SELECT + MIN(`timestamp`) AS submission_timestamp, + jsonPayload.fields.nimbus_user_id AS nimbus_user_id, +FROM + `moz-fx-fxa-prod.gke_fxa_prod_log.stderr` +WHERE + ( + DATE(_PARTITIONTIME) + BETWEEN DATE_SUB(@submission_date, INTERVAL 1 DAY) + AND DATE_ADD(@submission_date, INTERVAL 1 DAY) + ) + AND DATE(`timestamp`) = @submission_date + AND jsonPayload.type = 'glean.user.delete' + AND jsonPayload.fields.nimbus_user_id IS NOT NULL +GROUP BY + jsonPayload.fields.nimbus_user_id diff --git a/sql/moz-fx-data-shared-prod/subscription_platform_backend_cirrus_derived/delete_events_v2/schema.yaml b/sql/moz-fx-data-shared-prod/subscription_platform_backend_cirrus_derived/delete_events_v2/schema.yaml new file mode 100644 index 00000000000..1b1eeca2ab5 --- /dev/null +++ b/sql/moz-fx-data-shared-prod/subscription_platform_backend_cirrus_derived/delete_events_v2/schema.yaml @@ -0,0 +1,9 @@ +fields: +- name: submission_timestamp + type: TIMESTAMP + mode: NULLABLE + description: Earliest timestamp of the account deletion log entry for this nimbus_user_id on the given date +- name: nimbus_user_id + type: STRING + mode: NULLABLE + description: Pre-derived Nimbus user identifier logged by payments-api at account deletion time