Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rzats committed Jan 17, 2024
1 parent 03cb5b4 commit f64688a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions integrations/acquisition/covidcast/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def _find_matches_for_row(self, row):
cur.execute(q)
res = cur.fetchone()
if res:
# Create a dictionary of column names (from cursor.description) & values
results[table] = dict(zip([desc[0] for desc in cur.description], res))
else:
results[table] = None
Expand Down
2 changes: 2 additions & 0 deletions integrations/server/test_covidcast_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ def test_backfill(self):

def test_meta(self):
"""Request a signal from the /meta endpoint."""

num_rows = 10
rows = [CovidcastTestRow.make_default_row(time_value=2020_04_01 + i, value=i, source="fb-survey", signal="smoothed_cli") for i in range(num_rows)]
self._insert_rows(rows)
Expand Down Expand Up @@ -343,6 +344,7 @@ def test_meta_restricted(self):
# by _load_data_signals() which attaches a list of signals to each source,
# in turn fed by src/server/endpoints/covidcast_utils/db_signals.csv)
# insert data from two different sources, one restricted/protected (quidel), one not

self._insert_rows([
CovidcastTestRow.make_default_row(source="quidel", signal="raw_pct_negative"),
CovidcastTestRow.make_default_row(source="hhs", signal="confirmed_admissions_covid_1d")
Expand Down
8 changes: 4 additions & 4 deletions src/acquisition/covid_hosp/common/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ def connect(database_class, mysql_connector_impl=MySQLdb):
# connect to the database
user, password = secrets.db.epi
connection = mysql_connector_impl.connect(
host=secrets.db.host,
user=user,
password=password,
database='epidata')
host=secrets.db.host,
user=user,
password=password,
database='epidata')

try:
# provide the connection to the context manager
Expand Down
1 change: 1 addition & 0 deletions src/acquisition/covidcast/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def do_analyze(self):
f'''ANALYZE TABLE
signal_dim, geo_dim,
{self.load_table}, {self.history_table}, {self.latest_table}''')
# Append lists of column names (from cursor.description) & values
output = [desc[0] for desc in self._cursor.description] + list(self._cursor.fetchall())
get_structured_logger('do_analyze').info("ANALYZE results", results=str(output))

Expand Down

0 comments on commit f64688a

Please sign in to comment.