1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| import sys,json
| from pathlib import Path
| P=Path(__file__).parent
| sys.stdout.reconfigure(encoding='utf8')
| sys.path.insert(0,str(P.parent/'iqc-import-20261012/deps'))
| import pymysql
| from validate_plan import validate
| plan=json.loads((P/'plan.json').read_text(encoding='utf8'));r=json.loads((P/'result.json').read_text(encoding='utf8'));before=json.loads((P/r['backup']).read_text(encoding='utf8'))['tables']
| 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("SET time_zone='+08:00'");q.execute('SELECT NOW() now');now=q.fetchone()['now'];after={}
| for t in before:
| q.execute('SELECT * FROM `'+t+'` WHERE deleted=0 ORDER BY id');after[t]=q.fetchall()
| result={**validate(before,after,plan,now),'verified_after_commit':True,'at':str(now)}
| (P/'verification.json').write_text(json.dumps(result,ensure_ascii=False,indent=2),encoding='utf8');print(json.dumps(result,ensure_ascii=False))
| c.close()
|
|