Browse Source

status_exists_tracking

AmifaRaj 1 year ago
parent
commit
356080c589
1 changed files with 10 additions and 5 deletions
  1. 10
    5
      bookdata/tracking.py

+ 10
- 5
bookdata/tracking.py

@@ -130,11 +130,16 @@ def end_stage(cur, stage, key=None):
 
 def stage_exists(stage):
     "Query whether we have data for a stage"
-    with db.connect() as dbc, dbc.cursor() as cur:
-        cur.execute('SELECT COUNT(*) FROM stage_status WHERE stage_name = %s', [stage])
-        count, = cur.fetchone()
-        _log.debug('have %d records for stage %s', count, stage)
-        return count
+    try:
+            
+        with db.connect() as dbc, dbc.cursor() as cur:
+            cur.execute('SELECT COUNT(*) FROM stage_status WHERE stage_name = %s', [stage])
+            count, = cur.fetchone()
+            _log.debug('have %d records for stage %s', count, stage)
+            return count
+    except:
+        return False
+
 
 
 def stage_status(stage, file=None, *, timestamps=False):