From 440ba12d777263a500ca2e3b1e70da6809cd75c2 Mon Sep 17 00:00:00 2001 From: Braunk Date: Tue, 23 Jan 2024 17:26:43 -0600 Subject: [PATCH] feat(activity_stream): create new activity stream live view (#4850) * feat(activity_stream): in order to update a prefect to using new service account to access live data we need to create a proper live view with access granted to a proper workgroup that the service account will be assigned to cannot merge until new workgroup is properly setup * feat: adding new workgroup to dataset * feat(prefect): adding new workgroup as needed for access to newtab data * Update sql/moz-fx-data-shared-prod/activity_stream/impression_stats_live/metadata.yaml Co-authored-by: whd * Update sql/moz-fx-data-shared-prod/firefox_desktop/dataset_metadata.yaml Co-authored-by: whd * Update sql/moz-fx-data-shared-prod/firefox_desktop/newtab_live/metadata.yaml Co-authored-by: whd * feat(prefect): updating newtab dataset permissions for prefect * Use same access regime for pocket/prefect as mozsocial/prefect --------- Co-authored-by: whd Co-authored-by: Wesley Dawson --- .../activity_stream/dataset_metadata.yaml | 1 + .../impression_stats_live/metadata.yaml | 8 ++++++++ .../activity_stream/impression_stats_live/view.sql | 10 ++++++++++ .../activity_stream_derived/dataset_metadata.yaml | 1 + .../firefox_desktop/newtab_live/metadata.yaml | 7 ++++--- 5 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 sql/moz-fx-data-shared-prod/activity_stream/impression_stats_live/metadata.yaml create mode 100644 sql/moz-fx-data-shared-prod/activity_stream/impression_stats_live/view.sql diff --git a/sql/moz-fx-data-shared-prod/activity_stream/dataset_metadata.yaml b/sql/moz-fx-data-shared-prod/activity_stream/dataset_metadata.yaml index ad4e5d32c3..07a675d29f 100644 --- a/sql/moz-fx-data-shared-prod/activity_stream/dataset_metadata.yaml +++ b/sql/moz-fx-data-shared-prod/activity_stream/dataset_metadata.yaml @@ -10,3 +10,4 @@ workgroup_access: members: - workgroup:mozilla-confidential - workgroup:pocket/prefect + - workgroup:mozsocial/prefect diff --git a/sql/moz-fx-data-shared-prod/activity_stream/impression_stats_live/metadata.yaml b/sql/moz-fx-data-shared-prod/activity_stream/impression_stats_live/metadata.yaml new file mode 100644 index 0000000000..629b57d25e --- /dev/null +++ b/sql/moz-fx-data-shared-prod/activity_stream/impression_stats_live/metadata.yaml @@ -0,0 +1,8 @@ +--- +# yamllint disable rule:line-length +friendly_name: Live Pings for `activity_stream_live.impression_stats_v1` +description: |- + A live view of pings sent to the + `activity_stream_live.impression_stats_v1` table. + + Clustering fields: `submission_timestamp` diff --git a/sql/moz-fx-data-shared-prod/activity_stream/impression_stats_live/view.sql b/sql/moz-fx-data-shared-prod/activity_stream/impression_stats_live/view.sql new file mode 100644 index 0000000000..28905629ea --- /dev/null +++ b/sql/moz-fx-data-shared-prod/activity_stream/impression_stats_live/view.sql @@ -0,0 +1,10 @@ +CREATE OR REPLACE VIEW + `moz-fx-data-shared-prod.activity_stream.impression_stats_live` +AS +SELECT + * REPLACE (mozfun.norm.metadata(metadata) AS metadata) +FROM + -- We explicitly choose v1 for now, but will transition to a unioned view + -- over v1 and v2 as the new schema is rolled out; see + -- https://bugzilla.mozilla.org/show_bug.cgi?id=1761790 + `moz-fx-data-shared-prod.activity_stream_live.impression_stats_v1` diff --git a/sql/moz-fx-data-shared-prod/activity_stream_derived/dataset_metadata.yaml b/sql/moz-fx-data-shared-prod/activity_stream_derived/dataset_metadata.yaml index 003f727354..f8d9a1eade 100644 --- a/sql/moz-fx-data-shared-prod/activity_stream_derived/dataset_metadata.yaml +++ b/sql/moz-fx-data-shared-prod/activity_stream_derived/dataset_metadata.yaml @@ -10,3 +10,4 @@ workgroup_access: members: - workgroup:mozilla-confidential - workgroup:pocket/prefect + - workgroup:mozsocial/prefect diff --git a/sql/moz-fx-data-shared-prod/firefox_desktop/newtab_live/metadata.yaml b/sql/moz-fx-data-shared-prod/firefox_desktop/newtab_live/metadata.yaml index 7834adf830..5fbb44e3d1 100644 --- a/sql/moz-fx-data-shared-prod/firefox_desktop/newtab_live/metadata.yaml +++ b/sql/moz-fx-data-shared-prod/firefox_desktop/newtab_live/metadata.yaml @@ -8,6 +8,7 @@ description: |- Clustering fields: `submission_timestamp` workgroup_access: - - role: roles/bigquery.dataViewer - members: - - workgroup:pocket/prefect +- role: roles/bigquery.dataViewer + members: + - workgroup:pocket/prefect + - workgroup:mozsocial/prefect