Skip to content

Commit

Permalink
do not fail the entire report if a branch cannot be found (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrpo authored Apr 27, 2024
1 parent 1e3d4a8 commit da6d21d
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions report.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,22 @@
exectime = {}

for branch in branches:
cursor.execute("SELECT date FROM [%s] ORDER BY date DESC LIMIT 1" % branch)
v = cursor.fetchone()[0]
try:
cursor.execute("SELECT date FROM [%s] ORDER BY date DESC LIMIT 1" % branch)
one = cursor.fetchone()
if one == None:
print("No such table '%s'; specify it using --branch=XXX when running test.py" % branch)
# ignore this table and continue
branches.remove(branch)
continue
else:
v = one[0]
except:
print("No such table '%s'; specify it using --branch=XXX when running test.py" % branch)
# ignore this table and continue
branches.remove(branch)
continue

dates_str[branch] = str(datetime.datetime.fromtimestamp(v).strftime('%Y-%m-%d %H:%M:%S'))
cursor.execute('''CREATE INDEX IF NOT EXISTS [idx_%s_date] ON [%s](date)''' % (branch,branch))

Expand Down

0 comments on commit da6d21d

Please sign in to comment.