MCPcopy
hub / github.com/PromtEngineer/localGPT / check_database_access

Function check_database_access

system_health_check.py:93–114  ·  view source on GitHub ↗

Test database access

()

Source from the content-addressed store, hash-verified

91 return False
92
93def check_database_access():
94 """Test database access"""
95 print_status("Testing database access...")
96 try:
97 import lancedb
98 db = lancedb.connect('./lancedb')
99 tables = db.table_names()
100
101 print_status(f"LanceDB connected - {len(tables)} tables available", True)
102 if tables:
103 print("📋 Available tables:")
104 for table in tables[:5]: # Show first 5 tables
105 print(f" - {table}")
106 if len(tables) > 5:
107 print(f" ... and {len(tables) - 5} more")
108 else:
109 print_status("No tables found - may need to index documents first", None)
110
111 return True
112 except Exception as e:
113 print_status(f"Database access failed: {e}", False)
114 return False
115
116def check_sample_query(agent):
117 """Test a sample query if tables exist"""

Callers 1

mainFunction · 0.85

Calls 1

print_statusFunction · 0.85

Tested by

no test coverage detected