-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
5 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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
22 changes: 22 additions & 0 deletions
22
sql/moz-fx-data-shared-prod/accounts_backend_external/emails_v1/metadata.yaml
This file contains 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,22 @@ | ||
--- | ||
friendly_name: Emails table from production FxA database | ||
description: |- | ||
A mirror of the `emails` table from the production FxA CloudSQL database, | ||
updated daily to match the current state of the table. | ||
Some fields in this table are converted to a more user-friendly, BigQuery-native format: | ||
- `uid` is converted from bytes to a hex string | ||
- boolean integer columns are converted to BOOL | ||
- timestamp columns are converted to TIMESTAMP | ||
See https://mozilla.github.io/ecosystem-platform/reference/database-structure#database-fxa | ||
owners: | ||
- akomar@mozilla.com | ||
labels: | ||
application: accounts_backend | ||
schedule: daily | ||
scheduling: | ||
dag_name: bqetl_accounts_backend_external | ||
# destination is the whole table, not a single partition, | ||
# so don't use date_partition_parameter | ||
date_partition_parameter: null | ||
referenced_tables: [] |
25 changes: 25 additions & 0 deletions
25
sql/moz-fx-data-shared-prod/accounts_backend_external/emails_v1/query.sql
This file contains 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,25 @@ | ||
SELECT | ||
id, | ||
normalizedEmail, | ||
email, | ||
TO_HEX(uid) AS uid, | ||
SAFE_CAST(isVerified AS BOOL) AS isVerified, | ||
SAFE_CAST(isPrimary AS BOOL) AS isPrimary, | ||
SAFE.TIMESTAMP_MILLIS(SAFE_CAST(verifiedAt AS INT)) AS verifiedAt, | ||
SAFE.TIMESTAMP_MILLIS(SAFE_CAST(createdAt AS INT)) AS createdAt, | ||
FROM | ||
EXTERNAL_QUERY( | ||
"moz-fx-fxa-prod.us.fxa-rds-prod-prod-fxa", | ||
"""SELECT | ||
id, | ||
normalizedEmail, | ||
email, | ||
uid, | ||
isVerified, | ||
isPrimary, | ||
verifiedAt, | ||
createdAt | ||
FROM | ||
emails | ||
""" | ||
) |
29 changes: 29 additions & 0 deletions
29
sql/moz-fx-data-shared-prod/accounts_backend_external/emails_v1/schema.yaml
This file contains 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,29 @@ | ||
fields: | ||
- name: id | ||
type: INTEGER | ||
mode: NULLABLE | ||
- name: normalizedEmail | ||
type: STRING | ||
mode: NULLABLE | ||
- name: email | ||
type: STRING | ||
mode: NULLABLE | ||
- name: uid | ||
type: STRING | ||
mode: NULLABLE | ||
description: |- | ||
Account ID in hexadecimal format. | ||
FxA stores this as bytes, for purposes of logging or integration | ||
with other systems we convert it to a hex string. | ||
- name: isVerified | ||
type: BOOLEAN | ||
mode: NULLABLE | ||
- name: isPrimary | ||
type: BOOLEAN | ||
mode: NULLABLE | ||
- name: verifiedAt | ||
type: TIMESTAMP | ||
mode: NULLABLE | ||
- name: createdAt | ||
type: TIMESTAMP | ||
mode: NULLABLE |