-
Notifications
You must be signed in to change notification settings - Fork 124
chore(shredder): propagate subplat deletes to cirrus #8401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
sql/moz-fx-data-shared-prod/subscription_platform_backend_cirrus/delete_events/view.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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` |
17 changes: 17 additions & 0 deletions
17
...a-shared-prod/subscription_platform_backend_cirrus_derived/delete_events_v1/metadata.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
53 changes: 53 additions & 0 deletions
53
...-data-shared-prod/subscription_platform_backend_cirrus_derived/delete_events_v1/query.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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` | ||
relud marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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 | ||
7 changes: 7 additions & 0 deletions
7
...ata-shared-prod/subscription_platform_backend_cirrus_derived/delete_events_v1/schema.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
2 changes: 2 additions & 0 deletions
2
sql/moz-fx-data-shared-prod/subscription_platform_derived/encrypted_keys_v1/metadata.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| friendly_name: Encrypted Keys V1 | ||
| description: Encrypted keys |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.