File size: 762 Bytes
74bf532
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os
import sys

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from sqlalchemy import text

from uraas.database import Base, SessionLocal, engine


def inspect():
    session = SessionLocal()
    try:
        # Check if tables exist first
        tables = ["citations", "citation_metrics", "author_metrics"]
        for table in tables:
            try:
                res = session.execute(text(f"SELECT COUNT(*) FROM {table}")).scalar()
                print(f"Table '{table}' has {res} rows")
            except Exception as e:
                print(f"Table '{table}' error: {e}")

    except Exception as e:
        print(f"Error: {e}")
    finally:
        session.close()


if __name__ == "__main__":
    inspect()