Spaces:
Sleeping
Sleeping
Download check_db.py from HFShishir/leaseguard-api: direct link, hf CLI and curl.
- Browser
- Download file 582 Bytes
-
https://huggingface.co/spaces/HFShishir/leaseguard-api/resolve/main/check_db.py
- Command line
-
hf download hf://spaces/HFShishir/leaseguard-api/check_db.py
-
curl -L -o check_db.py https://huggingface.co/spaces/HFShishir/leaseguard-api/resolve/main/check_db.py
582 Bytes
| """ | |
| Database Connection Diagnostic — Local SQLite | |
| """ | |
| import sqlite3 | |
| import os | |
| DB_PATH = os.path.join(os.path.dirname(__file__), "leaseguard.db") | |
| print(f"--- DATABASE CONNECTION DIAGNOSTIC ---") | |
| print(f"Target: {DB_PATH}") | |
| try: | |
| print("Attempting connection...") | |
| conn = sqlite3.connect(DB_PATH) | |
| cursor = conn.cursor() | |
| cursor.execute("SELECT name FROM sqlite_master WHERE type='table';") | |
| tables = cursor.fetchall() | |
| print(f"SUCCESS: Connected! Tables: {[t[0] for t in tables]}") | |
| conn.close() | |
| except Exception as e: | |
| print(f"CONNECTION FAILED: {e}") | |