Spaces:
Sleeping
Sleeping
database fix
Browse files- src/database.py +9 -2
src/database.py
CHANGED
@@ -9,7 +9,14 @@ def init_supabase():
|
|
9 |
return create_client(url, key)
|
10 |
|
11 |
def get_hash(database, table, hash):
|
12 |
-
|
|
|
|
|
|
|
|
|
13 |
|
14 |
def upsert_data(database, table, data):
|
15 |
-
|
|
|
|
|
|
|
|
9 |
return create_client(url, key)
|
10 |
|
11 |
def get_hash(database, table, hash):
|
12 |
+
try:
|
13 |
+
return database.table(table).select("*").eq("hash", hash).execute()
|
14 |
+
except Exception as e:
|
15 |
+
return {}
|
16 |
+
|
17 |
|
18 |
def upsert_data(database, table, data):
|
19 |
+
try:
|
20 |
+
return database.table(table).upsert(data).execute()
|
21 |
+
except Exception as e:
|
22 |
+
return {}
|