Skip to content

Commit

Permalink
add test asserting all derived tables have rows
Browse files Browse the repository at this point in the history
  • Loading branch information
alistairewj committed Dec 15, 2021
1 parent 6351e10 commit 4b4a844
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions mimic-iv/tests/test_all_tables.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import pandas as pd
from pandas.io import gbq

def test_tables_have_data(dataset, project_id, concepts):
"""Verifies each table has data."""

for folder, concept_list in concepts.items():
for concept_name in concept_list:
query = f"""
SELECT *
FROM {dataset}.{concept_name}
LIMIT 5
"""
df = gbq.read_gbq(query, project_id=project_id, dialect="standard")
assert df.shape[0] > 0, f'did not find table for {folder}.{concept_name}'

0 comments on commit 4b4a844

Please sign in to comment.