import sqlite3 db_path = "/app/company-explorer/companies_v3_fixed_2.db" conn = sqlite3.connect(db_path) cursor = conn.cursor() for table in ['signals', 'enrichment_data']: print(f"\nSchema of {table}:") cursor.execute(f"PRAGMA table_info({table})") for col in cursor.fetchall(): print(col) print(f"\nContent of {table} for company_id=12 (guessing FK):") # Try to find FK column cursor.execute(f"PRAGMA table_info({table})") cols = [c[1] for c in cursor.fetchall()] fk_col = next((c for c in cols if 'company_id' in c or 'account_id' in c), None) if fk_col: cursor.execute(f"SELECT * FROM {table} WHERE {fk_col}=12") rows = cursor.fetchall() for row in rows: print(dict(zip(cols, row))) else: print(f"Could not guess FK column for {table}") conn.close()