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 table_name FROM information_schema.tables WHERE table_schema = 'public'")
tables = cur.fetchall()
print("vala_bi库public模式下的表：")
for table in tables:
    if 'seasonal' in table[0] or 'ticket' in table[0]:
        print(f"→ {table[0]}")

cur.close()
conn.close()
