Files
effekt-interface/check_permission_table.py
2026-05-11 14:29:16 +08:00

36 lines
959 B
Python

#!/usr/bin/env python
# encoding: UTF-8
import psycopg2
def check_permission_table():
try:
conn = psycopg2.connect(
host="39.170.26.156",
port=8366,
dbname="test",
user="postgres",
password="difyai123456"
)
cursor = conn.cursor()
cursor.execute("""
SELECT column_name, data_type, is_nullable
FROM information_schema.columns
WHERE table_name = 'permission'
ORDER BY ordinal_position;
""")
print("Permission 表结构:")
print("-" * 60)
print(f"{'字段名':<20} {'类型':<20} {'是否可空'}")
print("-" * 60)
for row in cursor.fetchall():
print(f"{row[0]:<20} {row[1]:<20} {row[2]}")
conn.close()
except Exception as e:
print("Error: " + str(e))
if __name__ == "__main__":
check_permission_table()