Skip to content

Commit 4e56dcb

Browse files
committed
review suggestions
1 parent bf86b29 commit 4e56dcb

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/acquisition/covidcast/database.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ def get_covidcast_meta(self):
546546

547547
meta = []
548548

549-
sql = 'SELECT `source`, `signal` FROM covidcast GROUP BY `source`, `signal` ORDER BY `source` ASC, `signal` ASC;'
549+
sql = 'SELECT `source`, `signal` FROM covidcast WHERE NOT `is_wip` GROUP BY `source`, `signal` ORDER BY `source` ASC, `signal` ASC;'
550550
self._cursor.execute(sql)
551551
for source, signal in [ss for ss in self._cursor]: #NOTE: this obfuscation protects the integrity of the cursor; using the cursor as a generator will cause contention w/ subsequent queries
552552

@@ -594,20 +594,18 @@ def get_covidcast_meta(self):
594594
x.`max_issue` = t.`issue` AND
595595
x.`time_type` = t.`time_type` AND
596596
x.`time_value` = t.`time_value` AND
597+
x.`source` = t.`source` AND
598+
x.`signal` = t.`signal` AND
597599
x.`geo_type` = t.`geo_type` AND
598600
x.`geo_value` = t.`geo_value`
599-
WHERE
600-
NOT t.`is_wip` AND
601-
t.`source` = %s AND
602-
t.`signal` = %s
603601
GROUP BY
604602
t.`time_type`,
605603
t.`geo_type`
606604
ORDER BY
607605
t.`time_type` ASC,
608606
t.`geo_type` ASC
609607
'''
610-
self._cursor.execute(sql, (source, signal, source, signal))
608+
self._cursor.execute(sql, (source, signal))
611609
meta.extend(list(dict(zip(self._cursor.column_names,x)) for x in self._cursor))
612610

613611
return meta
@@ -627,6 +625,8 @@ def update_covidcast_meta_cache(self, metadata):
627625
self._cursor.execute(sql, (epidata_json,))
628626

629627
def retrieve_covidcast_meta_cache(self):
628+
"""Useful for viewing cache entries (was used in debugging)"""
629+
630630
sql = '''
631631
SELECT `epidata`
632632
FROM `covidcast_meta_cache`

0 commit comments

Comments
 (0)