Skip to content

Commit 3bdd444

Browse files
committed
updated function calling
1 parent cd482ba commit 3bdd444

14 files changed

Lines changed: 158 additions & 60 deletions

definitions/output/reports/cwv_tech_adoption.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ publish('cwv_tech_adoption', {
1313
DELETE FROM ${ctx.self()}
1414
WHERE date = '${pastMonth}';
1515
`).query(ctx => `
16-
/* {"dataform_trigger": "report_cwv_tech_complete", "date": "${pastMonth}", "name": "adoption", "type": "report"} */
1716
SELECT
1817
date,
1918
app AS technology,
@@ -30,4 +29,18 @@ GROUP BY
3029
app,
3130
rank,
3231
geo
33-
`)
32+
`).postOps(ctx => `
33+
SELECT
34+
reports.run_export_job(
35+
JSON '''{
36+
"destination": "firestore",
37+
"config": {
38+
"databaseId": "tech-report-apis-{constants.environment}",
39+
"collectionName": "adoption",
40+
"collectionType": "report",
41+
"date": "${pastMonth}"
42+
},
43+
"query": "SELECT STRING(date) AS date, * EXCEPT(date) FROM ${ctx.self()} WHERE date = '${pastMonth}'"
44+
}'''
45+
);
46+
`)

definitions/output/reports/cwv_tech_categories.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ publish('cwv_tech_categories', {
55
type: 'table',
66
tags: ['crux_ready']
77
}).query(ctx => `
8-
/* {"dataform_trigger": "report_cwv_tech_complete", "name": "categories", "type": "dict"} */
98
WITH pages AS (
109
SELECT DISTINCT
1110
client,
@@ -91,4 +90,18 @@ SELECT
9190
) AS origins,
9291
NULL AS technologies
9392
FROM total_pages
94-
`)
93+
`).postOps(ctx => `
94+
SELECT
95+
reports.run_export_job(
96+
JSON '''{
97+
"destination": "firestore",
98+
"config": {
99+
"databaseId": "tech-report-apis-{constants.environment}",
100+
"collectionName": "categories",
101+
"collectionType": "dict"
102+
},
103+
"query": "SELECT * FROM ${ctx.self()}"
104+
}'''
105+
);
106+
`)
107+

definitions/output/reports/cwv_tech_core_web_vitals.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ return Object.values(vitals)
6868
DELETE FROM ${ctx.self()}
6969
WHERE date = '${pastMonth}';
7070
`).query(ctx => `
71-
/* {"dataform_trigger": "report_cwv_tech_complete", "date": "${pastMonth}", "name": "core_web_vitals", "type": "report"} */
7271
SELECT
7372
date,
7473
app AS technology,
@@ -98,4 +97,18 @@ GROUP BY
9897
app,
9998
rank,
10099
geo
101-
`)
100+
`).postOps(ctx => `
101+
SELECT
102+
reports.run_export_job(
103+
JSON '''{
104+
"destination": "firestore",
105+
"config": {
106+
"databaseId": "tech-report-apis-{constants.environment}",
107+
"collectionName": "core_web_vitals",
108+
"collectionType": "report",
109+
"date": "${pastMonth}"
110+
},
111+
"query": "SELECT STRING(date) AS date, * EXCEPT(date) FROM ${ctx.self()} WHERE date = '${pastMonth}'"
112+
}'''
113+
);
114+
`)

definitions/output/reports/cwv_tech_lighthouse.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ return Object.values(lighthouse)
5454
DELETE FROM ${ctx.self()}
5555
WHERE date = '${pastMonth}';
5656
`).query(ctx => `
57-
/* {"dataform_trigger": "report_cwv_tech_complete", "date": "${pastMonth}", "name": "lighthouse", "type": "report"} */
5857
SELECT
5958
date,
6059
app AS technology,
@@ -75,4 +74,18 @@ GROUP BY
7574
app,
7675
rank,
7776
geo
78-
`)
77+
`).postOps(ctx => `
78+
SELECT
79+
reports.run_export_job(
80+
JSON '''{
81+
"destination": "firestore",
82+
"config": {
83+
"databaseId": "tech-report-apis-{constants.environment}",
84+
"collectionName": "lighthouse",
85+
"collectionType": "report",
86+
"date": "${pastMonth}"
87+
},
88+
"query": "SELECT STRING(date) AS date, * EXCEPT(date) FROM ${ctx.self()} WHERE date = '${pastMonth}'"
89+
}'''
90+
);
91+
`)

definitions/output/reports/cwv_tech_page_weight.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ return Object.values(pageWeight)
4646
DELETE FROM ${ctx.self()}
4747
WHERE date = '${pastMonth}';
4848
`).query(ctx => `
49-
/* {"dataform_trigger": "report_cwv_tech_complete", "date": "${pastMonth}", "name": "page_weight", "type": "report"} */
5049
SELECT
5150
date,
5251
app AS technology,
@@ -65,4 +64,18 @@ GROUP BY
6564
app,
6665
rank,
6766
geo
68-
`)
67+
`).postOps(ctx => `
68+
SELECT
69+
reports.run_export_job(
70+
JSON '''{
71+
"destination": "firestore",
72+
"config": {
73+
"databaseId": "tech-report-apis-{constants.environment}",
74+
"collectionName": "page_weight",
75+
"collectionType": "report",
76+
"date": "${pastMonth}"
77+
},
78+
"query": "SELECT STRING(date) AS date, * EXCEPT(date) FROM ${ctx.self()} WHERE date = '${pastMonth}'"
79+
}'''
80+
);
81+
`)

definitions/output/reports/cwv_tech_technologies.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ publish('cwv_tech_technologies', {
55
type: 'table',
66
tags: ['crux_ready']
77
}).query(ctx => `
8-
/* {"dataform_trigger": "report_cwv_tech_complete", "name": "technologies", "type": "dict"} */
98
WITH pages AS (
109
SELECT DISTINCT
1110
client,
@@ -86,4 +85,17 @@ SELECT
8685
MAX(IF(client = 'mobile', origins, 0)) AS mobile
8786
) AS origins
8887
FROM total_pages
89-
`)
88+
`).postOps(ctx => `
89+
SELECT
90+
reports.run_export_job(
91+
JSON '''{
92+
"destination": "firestore",
93+
"config": {
94+
"databaseId": "tech-report-apis-{constants.environment}",
95+
"collectionName": "technologies",
96+
"collectionType": "dict"
97+
},
98+
"query": "SELECT * FROM ${ctx.self()}"
99+
}'''
100+
);
101+
`)

definitions/output/reports/tech_report_adoption.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,17 @@ GROUP BY
3232
technology,
3333
version
3434
`).postOps(ctx => `
35-
SELECT
36-
reports.run_export_job(
37-
JSON '''{
38-
"dataform_trigger": "tech_report_complete",
39-
"date": "${pastMonth}",
40-
"name": "adoption",
41-
"type": "report",
42-
"environment": "${constants.environment}"
43-
}'''
44-
);
35+
SELECT
36+
reports.run_export_job(
37+
JSON '''{
38+
"destination": "firestore",
39+
"config": {
40+
"databaseId": "tech-report-api-{constants.environment}",
41+
"collectionName": "adoption",
42+
"collectionType": "report",
43+
"date": "${pastMonth}"
44+
},
45+
"query": "SELECT STRING(date) AS date, * EXCEPT(date) FROM ${ctx.self()} WHERE date = '${pastMonth}'"
46+
}'''
47+
);
4548
`)

definitions/output/reports/tech_report_audits.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,14 @@ GROUP BY
8989
SELECT
9090
reports.run_export_job(
9191
JSON '''{
92-
"dataform_trigger": "tech_report_complete",
93-
"date": "${pastMonth}",
94-
"name": "audits",
95-
"type": "report",
96-
"environment": "${constants.environment}"
92+
"destination": "firestore",
93+
"config": {
94+
"databaseId": "tech-report-api-{constants.environment}",
95+
"collectionName": "audits",
96+
"collectionType": "report",
97+
"date": "${pastMonth}"
98+
},
99+
"query": "SELECT STRING(date) AS date, * EXCEPT(date) FROM ${ctx.self()} WHERE date = '${pastMonth}'"
97100
}'''
98101
);
99-
`)
102+
`)

definitions/output/reports/tech_report_categories.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,13 @@ FROM (
9494
SELECT
9595
reports.run_export_job(
9696
JSON '''{
97-
"dataform_trigger": "tech_report_complete",
98-
"name": "categories",
99-
"type": "dict",
100-
"environment": "${constants.environment}"
97+
"destination": "firestore",
98+
"config": {
99+
"databaseId": "tech-report-api-{constants.environment}",
100+
"collectionName": "categories",
101+
"collectionType": "dict"
102+
},
103+
"query": "SELECT * FROM ${ctx.self()}"
101104
}'''
102105
);
103-
`)
106+
`)

definitions/output/reports/tech_report_core_web_vitals.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,14 @@ GROUP BY
103103
SELECT
104104
reports.run_export_job(
105105
JSON '''{
106-
"dataform_trigger": "tech_report_complete",
107-
"date": "${pastMonth}",
108-
"name": "core_web_vitals",
109-
"type": "report",
110-
"environment": "${constants.environment}"
106+
"destination": "firestore",
107+
"config": {
108+
"databaseId": "tech-report-api-{constants.environment}",
109+
"collectionName": "core_web_vitals",
110+
"collectionType": "report",
111+
"date": "${pastMonth}"
112+
},
113+
"query": "SELECT STRING(date) AS date, * EXCEPT(date) FROM ${ctx.self()} WHERE date = '${pastMonth}'"
111114
}'''
112115
);
113-
`)
116+
`)

0 commit comments

Comments
 (0)