Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,19 @@ import requests
|
|
| 6 |
HF_DB_URL = "https://huggingface.co/datasets/babilonczyk/swiss_prot/resolve/main/proteins.db"
|
| 7 |
LOCAL_DB_PATH = "proteins.db"
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
# Download the DB only if not already cached
|
| 10 |
def download_db(url: str, local_path: str):
|
| 11 |
if not os.path.exists(local_path):
|
|
|
|
| 6 |
HF_DB_URL = "https://huggingface.co/datasets/babilonczyk/swiss_prot/resolve/main/proteins.db"
|
| 7 |
LOCAL_DB_PATH = "proteins.db"
|
| 8 |
|
| 9 |
+
def print_schema():
|
| 10 |
+
cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")
|
| 11 |
+
tables = cursor.fetchall()
|
| 12 |
+
print("📋 Tables:", tables)
|
| 13 |
+
|
| 14 |
+
for (table_name,) in tables:
|
| 15 |
+
print(f"\n🔎 Columns in table '{table_name}':")
|
| 16 |
+
cursor.execute(f"PRAGMA table_info({table_name});")
|
| 17 |
+
for col in cursor.fetchall():
|
| 18 |
+
print(col)
|
| 19 |
+
|
| 20 |
+
print_schema()
|
| 21 |
+
|
| 22 |
# Download the DB only if not already cached
|
| 23 |
def download_db(url: str, local_path: str):
|
| 24 |
if not os.path.exists(local_path):
|