Files
Neo-ZQYY/scripts/ops/_check_settle_cols.py

13 lines
475 B
Python

"""查 dwd_settlement_head 列"""
import os
from pathlib import Path
from dotenv import load_dotenv
import psycopg2
load_dotenv(Path(__file__).resolve().parents[2] / ".env")
conn = psycopg2.connect(os.environ["PG_DSN"], connect_timeout=5)
cur = conn.cursor()
cur.execute("SELECT column_name, data_type FROM information_schema.columns WHERE table_schema='dwd' AND table_name='dwd_settlement_head' ORDER BY ordinal_position")
for r in cur.fetchall():
print(r)
conn.close()