leaseguard-api / check_db.py
HFShishir's picture
Upload 38 files
8f76784 verified
Raw History Blame Contribute Delete
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}")