ai_member_xiaoxi/scripts/check_seasonal_ticket_fields.py
2026-04-23 08:00:02 +08:00

30 lines
737 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import psycopg2
# 读取密码
DB_PASSWORD = ""
with open('/root/.openclaw/workspace/secrets.env', 'r') as f:
for line in f:
if line.startswith('PG_ONLINE_PASSWORD='):
DB_PASSWORD = line.strip().split('=', 1)[1].strip('"\'')
break
# 数据库连接
conn = psycopg2.connect(
host='bj-postgres-16pob4sg.sql.tencentcdb.com',
port=28591,
user='ai_member',
password=DB_PASSWORD,
database='vala_bi'
)
cur = conn.cursor()
# 查询表结构
cur.execute("SELECT column_name FROM information_schema.columns WHERE table_name = 'bi_vala_seasonal_ticket'")
columns = cur.fetchall()
print("bi_vala_seasonal_ticket表字段")
for col in columns:
print(col[0])
cur.close()
conn.close()