Test database access
()
| 91 | return False |
| 92 | |
| 93 | def 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 | |
| 116 | def check_sample_query(agent): |
| 117 | """Test a sample query if tables exist""" |