提交所有代码到 qiaoxinjiu 分支
This commit is contained in:
36
check_permission_table.py
Normal file
36
check_permission_table.py
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/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()
|
||||
Reference in New Issue
Block a user