import sys,json from pathlib import Path P=Path(__file__).parent sys.path.insert(0,str(P.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,connect_timeout=10,read_timeout=45) s={} with c.cursor() as q: q.execute('SELECT DATABASE() db');assert q.fetchone()['db']=='mom-hm' for t in ['mes_pro_process','mes_pro_process_content','mes_pro_process_param','mes_pro_route','mes_pro_route_process','mes_pro_route_product','mes_pro_route_product_bom','mes_md_item','mdm_item','system_dict_data','mes_pd_process_param_template']: q.execute('SHOW CREATE TABLE '+t);s[t+'_schema']=q.fetchone() q.execute('SELECT * FROM '+t+' WHERE deleted=0');s[t]=list(q.fetchall()) c.close() (P/'remote-snapshot.json').write_text(json.dumps(s,ensure_ascii=False,default=str,indent=2),encoding='utf8') print(json.dumps({k:len(v) for k,v in s.items() if isinstance(v,list)},ensure_ascii=False)) for t in ['mes_pro_process','mes_pro_route','mes_pro_route_process','mes_pro_route_product']: print(t,json.dumps(s[t][:30],ensure_ascii=False,default=str))