-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_lc_records.py
More file actions
35 lines (28 loc) · 1.38 KB
/
check_lc_records.py
File metadata and controls
35 lines (28 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3
"""Check if lc_records table exists and its structure."""
from app.db import engine
from sqlalchemy import text
def check_lc_records_table():
"""Check if lc_records table exists and show its structure."""
try:
with engine.connect() as conn:
# Check if table exists
result = conn.execute(text("SELECT name FROM sqlite_master WHERE type='table' AND name='lc_records'"))
table_exists = bool(result.fetchone())
print(f"lc_records table exists: {table_exists}")
if table_exists:
# Get table structure
result = conn.execute(text("PRAGMA table_info(lc_records)"))
columns = result.fetchall()
print("\nTable structure:")
for col in columns:
print(f" {col[1]} ({col[2]}) - nullable: {not col[3]}")
# Check if compliance_summary column exists
compliance_summary_exists = any(col[1] == 'compliance_summary' for col in columns)
print(f"\ncompliance_summary column exists: {compliance_summary_exists}")
else:
print("Table does not exist - need to create it first")
except Exception as e:
print(f"Error checking database: {e}")
if __name__ == "__main__":
check_lc_records_table()