Skip to content

Commit e1a94c9

Browse files
authored
SVCSE-1595 Setup import of tables from production FxA databases (#4597)
1 parent ec29797 commit e1a94c9

File tree

113 files changed

+1899
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+1899
-0
lines changed

bqetl_project.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ dry_run:
5252
- sql/moz-fx-data-shared-prod/accounts_backend_external/accounts_v1/query.sql
5353
- sql/moz-fx-data-shared-prod/accounts_backend_external/emails_v1/query.sql
5454
- sql/moz-fx-data-shared-prod/accounts_backend/accounts/view.sql
55+
- sql/moz-fx-data-shared-prod/accounts_db_external/**/*.sql
5556
- sql/moz-fx-data-shared-prod/accounts_db_nonprod_external/**/*.sql
5657
- sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_content_events_v1/query.sql
5758
- sql/moz-fx-data-shared-prod/firefox_accounts_derived/fxa_auth_bounce_events_v1/query.sql
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
friendly_name: Firefox Accounts Databases production External
3+
description: |-
4+
Data extracted from the production FxA backend services databases.
5+
See https://mozilla.github.io/ecosystem-platform/reference/database-structure#database-fxa for more information.
6+
7+
Access to this dataset is restricted to accounts-confidential workgroup because some tables here contain sensitive data.
8+
dataset_base_acl: restricted
9+
user_facing: false
10+
labels: {}
11+
workgroup_access:
12+
- role: roles/bigquery.dataViewer
13+
members:
14+
- workgroup:accounts-confidential
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
friendly_name: accountCustomers table from production fxa database
3+
description: >
4+
A mirror of the `accountCustomers` table from the production `fxa` CloudSQL database,
5+
updated daily to match the current state of the table.
6+
7+
See https://mozilla.github.io/ecosystem-platform/reference/database-structure#database-fxa
8+
owners:
9+
10+
labels:
11+
application: accounts_backend
12+
schedule: daily
13+
scheduling:
14+
dag_name: bqetl_accounts_backend_external
15+
# destination is the whole table, not a single partition,
16+
# so don't use date_partition_parameter
17+
date_partition_parameter: null
18+
referenced_tables: []
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
SELECT
2+
TO_HEX(uid) AS uid,
3+
stripeCustomerId,
4+
SAFE.TIMESTAMP_MILLIS(SAFE_CAST(createdAt AS INT)) AS createdAt,
5+
SAFE.TIMESTAMP_MILLIS(SAFE_CAST(updatedAt AS INT)) AS updatedAt,
6+
FROM
7+
EXTERNAL_QUERY(
8+
"moz-fx-fxa-prod.us.fxa-rds-prod-prod-fxa",
9+
"""SELECT
10+
uid,
11+
stripeCustomerId,
12+
createdAt,
13+
updatedAt
14+
FROM
15+
fxa.accountCustomers
16+
"""
17+
)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
fields:
2+
- name: uid
3+
type: STRING
4+
mode: NULLABLE
5+
description: Account ID in hexadecimal format.
6+
- name: stripeCustomerId
7+
type: STRING
8+
mode: NULLABLE
9+
- name: createdAt
10+
type: TIMESTAMP
11+
mode: NULLABLE
12+
- name: updatedAt
13+
type: TIMESTAMP
14+
mode: NULLABLE
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
friendly_name: accountResetTokens table from production fxa database
3+
description: >
4+
A mirror of the `accountResetTokens` table from the production `fxa` CloudSQL database,
5+
excluding columns containing confidential data, updated daily to match the current state of the table.
6+
7+
See https://mozilla.github.io/ecosystem-platform/reference/database-structure#database-fxa
8+
owners:
9+
10+
labels:
11+
application: accounts_backend
12+
schedule: daily
13+
scheduling:
14+
dag_name: bqetl_accounts_backend_external
15+
# destination is the whole table, not a single partition,
16+
# so don't use date_partition_parameter
17+
date_partition_parameter: null
18+
referenced_tables: []
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
SELECT
2+
TO_HEX(uid) AS uid,
3+
SAFE.TIMESTAMP_MILLIS(SAFE_CAST(createdAt AS INT)) AS createdAt,
4+
FROM
5+
EXTERNAL_QUERY(
6+
"moz-fx-fxa-prod.us.fxa-rds-prod-prod-fxa",
7+
"""SELECT
8+
uid,
9+
createdAt
10+
FROM
11+
fxa.accountResetTokens
12+
"""
13+
)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
fields:
2+
- name: uid
3+
type: STRING
4+
mode: NULLABLE
5+
description: Account ID in hexadecimal format.
6+
- name: createdAt
7+
type: TIMESTAMP
8+
mode: NULLABLE
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
friendly_name: accounts table from production fxa database
3+
description: >
4+
A mirror of the `accounts` table from the production `fxa` CloudSQL database,
5+
excluding columns containing confidential data, updated daily to match the current state of the table.
6+
7+
See https://mozilla.github.io/ecosystem-platform/reference/database-structure#database-fxa
8+
owners:
9+
10+
labels:
11+
application: accounts_backend
12+
schedule: daily
13+
scheduling:
14+
dag_name: bqetl_accounts_backend_external
15+
# destination is the whole table, not a single partition,
16+
# so don't use date_partition_parameter
17+
date_partition_parameter: null
18+
referenced_tables: []
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
SELECT
2+
TO_HEX(uid) AS uid,
3+
normalizedEmail,
4+
email,
5+
SAFE_CAST(emailVerified AS BOOL) AS emailVerified,
6+
verifierVersion,
7+
SAFE.TIMESTAMP_MILLIS(SAFE_CAST(verifierSetAt AS INT)) AS verifierSetAt,
8+
SAFE.TIMESTAMP_MILLIS(SAFE_CAST(createdAt AS INT)) AS createdAt,
9+
locale,
10+
SAFE.TIMESTAMP_MILLIS(SAFE_CAST(lockedAt AS INT)) AS lockedAt,
11+
SAFE.TIMESTAMP_MILLIS(SAFE_CAST(profileChangedAt AS INT)) AS profileChangedAt,
12+
SAFE.TIMESTAMP_MILLIS(SAFE_CAST(keysChangedAt AS INT)) AS keysChangedAt,
13+
ecosystemAnonId,
14+
SAFE.TIMESTAMP_MILLIS(SAFE_CAST(disabledAt AS INT)) AS disabledAt,
15+
SAFE.TIMESTAMP_MILLIS(SAFE_CAST(metricsOptOutAt AS INT)) AS metricsOptOutAt,
16+
FROM
17+
EXTERNAL_QUERY(
18+
"moz-fx-fxa-prod.us.fxa-rds-prod-prod-fxa",
19+
"""SELECT
20+
uid,
21+
normalizedEmail,
22+
email,
23+
emailVerified,
24+
verifierVersion,
25+
verifierSetAt,
26+
createdAt,
27+
locale,
28+
lockedAt,
29+
profileChangedAt,
30+
keysChangedAt,
31+
ecosystemAnonId,
32+
disabledAt,
33+
metricsOptOutAt
34+
FROM
35+
fxa.accounts
36+
"""
37+
)

0 commit comments

Comments
 (0)