Skip to main content
Glama
check_image_tables.py2.69 kB
#!/usr/bin/env python3 """ Check if image-related tables exist in IRIS database. """ import sys import os sys.path.insert(0, os.path.dirname(__file__)) from src.db.connection import get_connection def check_tables(): """Check for image-related tables in IRIS.""" conn = get_connection() cursor = conn.cursor() print("Checking for image-related tables in IRIS...\n") # Check for MIMICCXRImages table try: cursor.execute(""" SELECT COUNT(*) as count FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'MIMICCXRImages' """) result = cursor.fetchone() if result and result[0] > 0: print("✓ VectorSearch.MIMICCXRImages table EXISTS") # Check row count cursor.execute("SELECT COUNT(*) FROM VectorSearch.MIMICCXRImages") count = cursor.fetchone()[0] print(f" - Contains {count} images") # Check schema cursor.execute(""" SELECT TOP 1 * FROM VectorSearch.MIMICCXRImages """) row = cursor.fetchone() if row: print(f" - Sample row columns: {len(row)} columns") print(f" - First row: {row[:5]}...") # Show first 5 columns else: print("✗ VectorSearch.MIMICCXRImages table NOT FOUND") print("\nTo create this table, you need to:") print("1. Have MIMIC-CXR dataset (PhysioNet access required)") print("2. Run image vectorization pipeline") print("3. Load vectors into IRIS") except Exception as e: print(f"✗ Error checking MIMICCXRImages: {e}") # Check for other image tables print("\nSearching for all tables with 'Image' in name...") try: cursor.execute(""" SELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE '%Image%' ORDER BY TABLE_SCHEMA, TABLE_NAME """) tables = cursor.fetchall() if tables: for schema, table in tables: print(f" - {schema}.{table}") # Get row count try: cursor.execute(f"SELECT COUNT(*) FROM {schema}.{table}") count = cursor.fetchone()[0] print(f" ({count} rows)") except: pass else: print(" No tables found with 'Image' in name") except Exception as e: print(f"Error searching for image tables: {e}") cursor.close() conn.close() print("\nDone!") if __name__ == "__main__": check_tables()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/isc-tdyar/medical-graphrag-assistant'

If you have feedback or need assistance with the MCP directory API, please join our Discord server