微信小程序页面迁移校验之前 P5任务处理之前
This commit is contained in:
21
scripts/ops/_check_int_site_ids.py
Normal file
21
scripts/ops/_check_int_site_ids.py
Normal file
@@ -0,0 +1,21 @@
|
||||
"""检查 dws schema 中所有 site_id 仍为 integer 的表"""
|
||||
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 table_schema, table_name, column_name, data_type
|
||||
FROM information_schema.columns
|
||||
WHERE column_name = 'site_id' AND data_type = 'integer'
|
||||
AND table_schema IN ('dws', 'dwd', 'ods', 'quality')
|
||||
ORDER BY table_schema, table_name
|
||||
""")
|
||||
rows = cur.fetchall()
|
||||
print(f"site_id 仍为 integer 的表 ({len(rows)}):")
|
||||
for r in rows:
|
||||
print(f" {r[0]}.{r[1]}.{r[2]} = {r[3]}")
|
||||
conn.close()
|
||||
Reference in New Issue
Block a user