File tree Expand file tree Collapse file tree 1 file changed +6
-18
lines changed Expand file tree Collapse file tree 1 file changed +6
-18
lines changed Original file line number Diff line number Diff line change @@ -27,22 +27,24 @@ def execute_query_and_insert_result(start_date, end_date):
27
27
28
28
query = """
29
29
SELECT
30
- date,
31
30
client,
32
31
app AS technology,
33
- # TODO
34
- NULL AS description,
32
+ description,
35
33
# CSV format
36
34
category,
37
- # TODO: other technologies within category?
38
35
NULL AS similar_technologies,
39
36
origins
40
37
FROM
41
38
`httparchive.core_web_vitals.technologies`
39
+ JOIN
40
+ `httparchive.core_web_vitals.technology_descriptions`
41
+ ON
42
+ app = technology
42
43
WHERE
43
44
geo = 'ALL' AND
44
45
rank = 'ALL'
45
46
"""
47
+
46
48
# Construct the WHERE clause based on the provided parameters
47
49
if start_date and end_date :
48
50
query += f" AND date >= '{ start_date } ' AND date <= '{ end_date } '"
@@ -56,24 +58,10 @@ def execute_query_and_insert_result(start_date, end_date):
56
58
# Create a new Firestore document for each result and insert it into the "technologies" collection
57
59
collection_ref = firestore_client .collection (u'technologies' )
58
60
59
- tech_collection_ref = firestore_client .collection (u'technologies-list' )
60
-
61
61
for row in results :
62
-
63
62
item = dict (row .items ())
64
-
65
- # Query the techonologies-list collection for the description
66
- #
67
- tech_query = tech_collection_ref .where ('name' , '==' , row ['technology' ])
68
- tech_query = tech_query .limit (1 )
69
- tech_results = tech_query .stream ()
70
- technology = {}
71
- for tech in tech_results :
72
- technology = tech .to_dict ()
73
-
74
63
# overriding BQ fields
75
64
item ['date' ] = str (row ['date' ])
76
- item ['description' ] = technology .get ('description' ,'' )
77
65
78
66
print (item )
79
67
You can’t perform that action at this time.
0 commit comments