云
昨天 74b0d9c5ab1dc316b29f8525dcffe45225d4c43c
1
2
3
4
5
6
7
8
9
10
11
12
13
import sys
from pathlib import Path
sys.path.insert(0,str(Path(__file__).parent.parent/'iqc-import-20261012/deps'))
import pymysql
c=pymysql.connect(host='36.213.150.237',port=10000,user='root',password=sys.stdin.readline().strip(),database='mom-hm',charset='utf8mb4',cursorclass=pymysql.cursors.DictCursor)
with c.cursor() as q:
 q.execute('SELECT DATABASE() db,@@hostname host');print(q.fetchall())
 for t in ['mes_qc_oqc','mes_qc_ipqc','mes_pro_work_order','mes_md_workstation']:
  q.execute('SELECT COUNT(*) n FROM information_schema.tables WHERE table_schema=DATABASE() AND table_name=%s',(t,));print('exists',t,q.fetchall(),q.mogrify('SELECT COUNT(*) n FROM information_schema.tables WHERE table_schema=DATABASE() AND table_name=%s',(t,)))
  q.execute('SELECT COUNT(*) n FROM `'+t+'` WHERE deleted=0');print('rows',t,q.fetchall())
 q.execute("SELECT table_name FROM information_schema.tables WHERE table_schema=DATABASE() AND (table_name LIKE 'mes_qc_%' OR table_name LIKE 'mes_pro_%' OR table_name LIKE 'mes_md_work%' OR table_name LIKE 'mes_wm_product%')")
 print(q.fetchall())
c.close()