Skip to content

Commit

Permalink
Merge pull request #155 from Roestlab/fix/check_sqlite_table
Browse files Browse the repository at this point in the history
check_sqlite_table: also check if entires in table
  • Loading branch information
singjc authored Nov 6, 2024
2 parents 7829e38 + 6e79d72 commit 804511a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion massdash/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,10 @@ def check_sqlite_table(con, table):
result = con.execute('SELECT count(name) FROM sqlite_master WHERE type="table" AND name=?', (table,))

if result.fetchone()[0] == 1:
table_present = True
# ensure the table is not empty
result = con.execute(f"SELECT COUNT(*) FROM {table}")
if result.fetchone()[0] > 0:
table_present = True

return table_present

Expand Down

0 comments on commit 804511a

Please sign in to comment.