29 lines
943 B
Python
29 lines
943 B
Python
|
|
|
||
|
|
import os
|
||
|
|
import pg8000.dbapi as pg
|
||
|
|
from lawrisk.utils.env_loader import load_env
|
||
|
|
|
||
|
|
def check():
|
||
|
|
load_env()
|
||
|
|
conn_params = {
|
||
|
|
"host": os.getenv("LIC_PG_HOST", "172.24.240.1"),
|
||
|
|
"port": int(os.getenv("LIC_PG_PORT", os.getenv("PG_PORT", "5432"))),
|
||
|
|
"user": os.getenv("LIC_PG_USER", os.getenv("PG_USER", "postgres")),
|
||
|
|
"password": os.getenv("LIC_PG_PASSWORD", ""),
|
||
|
|
"database": os.getenv("LIC_PG_DATABASE", "licensing_risks"),
|
||
|
|
}
|
||
|
|
conn = pg.connect(**conn_params)
|
||
|
|
cur = conn.cursor()
|
||
|
|
|
||
|
|
cur.execute("SELECT column_name FROM information_schema.columns WHERE table_name = 'permit_theme_rules'")
|
||
|
|
cols = [row[0] for row in cur.fetchall()]
|
||
|
|
print(f"Columns in 'permit_theme_rules': {cols}")
|
||
|
|
|
||
|
|
cur.execute("SELECT COUNT(*) FROM permit_theme_rules")
|
||
|
|
print(f"Row count in 'permit_theme_rules': {cur.fetchone()[0]}")
|
||
|
|
|
||
|
|
conn.close()
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
check()
|