26 lines
1.0 KiB
Python
26 lines
1.0 KiB
Python
import psycopg2, sys
|
|
sys.stdout.reconfigure(encoding='utf-8')
|
|
conn = psycopg2.connect(host='192.168.110.252', port=15432, dbname='postgresql', user='postgresql', password='Jchl1528', options='-c search_path=healthlink_his')
|
|
cur = conn.cursor()
|
|
|
|
# Check knowledge base tables
|
|
cur.execute("""SELECT table_name FROM information_schema.tables WHERE table_schema='healthlink_his' AND table_name ILIKE '%knowledge%'""")
|
|
tables = cur.fetchall()
|
|
print('Knowledge tables:', [t[0] for t in tables])
|
|
|
|
for t in tables:
|
|
cur.execute(f'SELECT COUNT(*) FROM {t[0]}')
|
|
cnt = cur.fetchone()[0]
|
|
print(f' {t[0]}: {cnt} rows')
|
|
|
|
# Check preop discussion tables
|
|
cur.execute("""SELECT table_name FROM information_schema.tables WHERE table_schema='healthlink_his' AND (table_name ILIKE '%discussion%' OR table_name ILIKE '%preop%')""")
|
|
tables2 = cur.fetchall()
|
|
print('Discussion tables:', [t[0] for t in tables2])
|
|
for t in tables2:
|
|
cur.execute(f'SELECT COUNT(*) FROM {t[0]}')
|
|
cnt = cur.fetchone()[0]
|
|
print(f' {t[0]}: {cnt} rows')
|
|
|
|
cur.close()
|
|
conn.close() |