Inayatgaming commited on
Commit
94bfdd9
·
verified ·
1 Parent(s): 4831215

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py CHANGED
@@ -97,5 +97,27 @@ def lookup(
97
  }
98
  }
99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  finally:
101
  con.close()
 
97
  }
98
  }
99
 
100
+ finally:
101
+ con.close()
102
+
103
+ @app.get("/index-status")
104
+ def index_status():
105
+ if not os.path.exists(DB_PATH):
106
+ return {
107
+ "installed": False,
108
+ "path": DB_PATH
109
+ }
110
+
111
+ con = duckdb.connect(DB_PATH, read_only=True)
112
+
113
+ try:
114
+ count = con.execute(
115
+ "SELECT COUNT(*) FROM authorized_lookup"
116
+ ).fetchone()[0]
117
+
118
+ return {
119
+ "installed": True,
120
+ "rows": count
121
+ }
122
  finally:
123
  con.close()