Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions bigquery_etl/shredder/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ def fields(self) -> tuple[str, ...]:
FXA_FRONTEND_GLEAN_SRC = DeleteSource(
table="accounts_frontend_stable.deletion_request_v1", field=GLEAN_CLIENT_ID
)
SUBPLAT_CIRRUS_SRC = DeleteSource(
table="subscription_platform_backend_cirrus.delete_events", field="nimbus_user_id"
)
EXPERIMENTER_BACKEND_SRC = DeleteSource(
table="experimenter_backend_stable.data_collection_opt_out_v1",
field=NIMBUS_USER_ID,
Expand Down Expand Up @@ -703,6 +706,14 @@ def fields(self) -> tuple[str, ...]:
table="experimenter_cirrus_stable.enrollment_status_v1",
field=CIRRUS_EVENTS_NIMBUS_USER_ID,
): EXPERIMENTER_BACKEND_SRC,
DeleteTarget(
table="subscription_platform_backend_cirrus_stable.enrollment_v1",
field=CIRRUS_EVENTS_NIMBUS_USER_ID,
): SUBPLAT_CIRRUS_SRC,
DeleteTarget(
table="subscription_platform_backend_cirrus_stable.enrollment_status_v1",
field=CIRRUS_EVENTS_NIMBUS_USER_ID,
): SUBPLAT_CIRRUS_SRC,
}

SEARCH_IGNORE_TABLES = {source.table for source in SOURCES}
Expand Down
1 change: 1 addition & 0 deletions bqetl_project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ dry_run:
- sql/moz-fx-data-shared-prod/monitoring_derived/table_storage_v1/query.sql
- sql/moz-fx-data-shared-prod/activity_stream/impression_stats_by_experiment/view.sql
- sql/moz-fx-data-shared-prod/activity_stream/impression_stats_flat/view.sql
- sql/moz-fx-data-shared-prod/subscription_platform_backend_cirrus_derived/delete_events_v1/query.sql
# uses time travel, will error on dates prior to the time travel window
- sql/moz-fx-data-shared-prod/accounts_backend_derived/monitoring_db_counts_v1/query.sql
- sql/moz-fx-data-shared-prod/accounts_backend_derived/monitoring_db_recovery_phones_counts_v1/query.sql
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CREATE OR REPLACE VIEW
`moz-fx-data-shared-prod.subscription_platform_backend_cirrus.delete_events`
AS
SELECT
*
FROM
`moz-fx-data-shared-prod.subscription_platform_backend_cirrus_derived.delete_events_v1`
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
friendly_name: Subscription Platform Backend Cirrus Delete Events
description: Deletion events for subscription platform backend cirrus, derived
from FxA's delete events and subplat's namespace secrets
owners:
- [email protected]
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
CREATE TEMP FUNCTION format_uuid(value STRING)
RETURNS STRING AS (
CONCAT(
SUBSTR(value, 1, 8),
"-",
SUBSTR(value, 9, 4),
"-",
SUBSTR(value, 13, 4),
"-",
SUBSTR(value, 17, 4),
"-",
SUBSTR(value, 21, 12)
)
);

CREATE TEMP FUNCTION uuid_v5(value STRING, namespace STRING)
RETURNS STRING AS (
FORMAT_UUID(
TO_HEX(
LEFT(
SHA1(CONCAT(FROM_HEX(REPLACE(namespace, "-", "")), CAST(value AS BYTES FORMAT 'UTF8'))),
16
) --
& FROM_HEX('ffffffffffff0fff3fffffffffffffff') --
| FROM_HEX('00000000000050008000000000000000')
)
)
);

WITH subplat_namespaces AS (
SELECT
CAST(
AEAD.DECRYPT_BYTES(
(SELECT keyset FROM `moz-fx-dataops-secrets.airflow_query_keys.subplat_namespaces_prod`),
ciphertext,
CAST(key_id AS BYTES)
) AS STRING
) AS namespace
FROM
`moz-fx-data-shared-prod.subscription_platform_derived.encrypted_keys_v1`
WHERE
key_id = 'subplat_namespaces_prod'
)
SELECT
fxa_delete_events.submission_timestamp,
uuid_v5(fxa_delete_events.user_id_unhashed, subplat_namespaces.namespace) AS nimbus_user_id,
FROM
`moz-fx-data-shared-prod.firefox_accounts.fxa_delete_events` AS fxa_delete_events
CROSS JOIN
subplat_namespaces
WHERE
DATE(fxa_delete_events.submission_timestamp) = @submission_date
AND fxa_delete_events.user_id_unhashed IS NOT NULL
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fields:
- name: submission_timestamp
type: TIMESTAMP
mode: NULLABLE
- name: nimbus_user_id
type: STRING
mode: NULLABLE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
friendly_name: Encrypted Keys V1
description: Encrypted keys