From 739ffd3080fa052e376b6ec2d44a4df8dec98daf Mon Sep 17 00:00:00 2001 From: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com> Date: Sun, 16 Feb 2025 15:27:20 +0100 Subject: [PATCH 1/2] migrated from scheduled queries --- .../core_web_vitals/technology_matrix.js | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 definitions/output/core_web_vitals/technology_matrix.js diff --git a/definitions/output/core_web_vitals/technology_matrix.js b/definitions/output/core_web_vitals/technology_matrix.js new file mode 100644 index 00000000..0e43475a --- /dev/null +++ b/definitions/output/core_web_vitals/technology_matrix.js @@ -0,0 +1,56 @@ +publish('technology_matrix', { + type: 'table', + schema: 'core_web_vitals', + bigquery: { + partitionBy: 'date', + clusterBy: ['client', 't1'] + }, + description: 'Used in: https://lookerstudio.google.com/u/2/reporting/0ad64c8f-644a-40f9-93e4-0ccd5f72b33d', + tags: ['crawl_complete'], + dependOnDependencyAssertions: true +}).query(ctx => ` +WITH a AS ( + SELECT + date, + client, + root_page, + technology AS t1, + ARRAY_TO_STRING(ARRAY(SELECT category FROM UNNEST(categories) AS category ORDER BY category), ', ') AS c1 + FROM ${ctx.ref('crawl', 'pages')}, + UNNEST(technologies) + WHERE + date = '${constants.currentMonth}' AND + is_root_page +), b AS ( + SELECT + client, + root_page, + technology AS t2, + ARRAY_TO_STRING(ARRAY(SELECT category FROM UNNEST(categories) AS category ORDER BY category), ', ') AS c2 + FROM ${ctx.ref('crawl', 'pages')}, + UNNEST(technologies) + WHERE + date = '${constants.currentMonth}' AND + is_root_page +) + + +SELECT + date, + client, + t1, + c1, + t2, + c2, + COUNT(DISTINCT root_page) AS pages +FROM a +LEFT JOIN b +USING (client, root_page) +GROUP BY + date, + client, + t1, + c1, + t2, + c2 +`) From f9b0f22da009ee8e2cdd6807a766cde0345fe43c Mon Sep 17 00:00:00 2001 From: Max Ostapenko <1611259+max-ostapenko@users.noreply.github.com> Date: Sun, 16 Feb 2025 16:57:17 +0100 Subject: [PATCH 2/2] cleanup --- definitions/output/core_web_vitals/technology_matrix.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/definitions/output/core_web_vitals/technology_matrix.js b/definitions/output/core_web_vitals/technology_matrix.js index 0e43475a..db092be0 100644 --- a/definitions/output/core_web_vitals/technology_matrix.js +++ b/definitions/output/core_web_vitals/technology_matrix.js @@ -6,8 +6,7 @@ publish('technology_matrix', { clusterBy: ['client', 't1'] }, description: 'Used in: https://lookerstudio.google.com/u/2/reporting/0ad64c8f-644a-40f9-93e4-0ccd5f72b33d', - tags: ['crawl_complete'], - dependOnDependencyAssertions: true + tags: ['crawl_complete'] }).query(ctx => ` WITH a AS ( SELECT