You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
2.2 KiB
46 lines
2.2 KiB
|
15 hours ago
|
# -*- coding: utf-8 -*-
|
||
|
|
"""heavy ❌3 现场取证:F-14 执行期失败原因 + F-13.10 SALES_ID assignable 数据态"""
|
||
|
|
import sys, io, json
|
||
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||
|
|
import pymysql
|
||
|
|
|
||
|
|
conn = pymysql.connect(host='8.129.84.155', user='root', password='Itc@123456',
|
||
|
|
database='crm', charset='utf8mb4', autocommit=True,
|
||
|
|
cursorclass=pymysql.cursors.DictCursor)
|
||
|
|
cur = conn.cursor()
|
||
|
|
|
||
|
|
TASK = 751728797912399872
|
||
|
|
|
||
|
|
print('== F-14 任务 751728797912399872 ==')
|
||
|
|
cur.execute("SELECT id,status,import_mode,total_count,insert_count,update_count,fail_count,"
|
||
|
|
"suspect_count,fail_reason FROM customer_import_task WHERE id=%s", (TASK,))
|
||
|
|
for x in cur.fetchall():
|
||
|
|
print(json.dumps({k: str(v) for k, v in x.items()}, ensure_ascii=False)[:400])
|
||
|
|
|
||
|
|
print('-- fail 明细(sheetName/rowNum/identity/reason 去重展示)--')
|
||
|
|
cur.execute("SELECT sheet_name,row_num,customer_identity,fail_field,LEFT(fail_reason,90) fr "
|
||
|
|
"FROM customer_import_fail WHERE task_id=%s ORDER BY id LIMIT 12", (TASK,))
|
||
|
|
for x in cur.fetchall():
|
||
|
|
print(json.dumps({k: str(v) for k, v in x.items()}, ensure_ascii=False)[:260])
|
||
|
|
|
||
|
|
print()
|
||
|
|
print('== customer 全列 NOT NULL 无默认扫描(D-05 族群清单)==')
|
||
|
|
cur.execute("SELECT COLUMN_NAME, COLUMN_TYPE, COLUMN_COMMENT FROM information_schema.COLUMNS "
|
||
|
|
"WHERE TABLE_SCHEMA='crm' AND TABLE_NAME='customer' AND IS_NULLABLE='NO' "
|
||
|
|
"AND COLUMN_DEFAULT IS NULL AND COLUMN_KEY NOT IN ('PRI')")
|
||
|
|
for x in cur.fetchall():
|
||
|
|
print(json.dumps({k: str(v) for k, v in x.items()}, ensure_ascii=False))
|
||
|
|
|
||
|
|
print()
|
||
|
|
print('== F-13.10 SALES_ID 数据态 ==')
|
||
|
|
cur.execute("SELECT id,username,dept_id,enabled,employment_status FROM auth_user "
|
||
|
|
"WHERE id IN ('760000000000000001','739564171091247104','744842318024015872')")
|
||
|
|
for x in cur.fetchall():
|
||
|
|
print(json.dumps({k: str(v) for k, v in x.items()}, ensure_ascii=False))
|
||
|
|
cur.execute("SELECT id,name,parent_id,ancestors FROM sys_dept "
|
||
|
|
"WHERE id IN ('744700334353416192','744841292483133440')")
|
||
|
|
for x in cur.fetchall():
|
||
|
|
print(json.dumps({k: str(v) for k, v in x.items()}, ensure_ascii=False))
|
||
|
|
conn.close()
|
||
|
|
print('DONE')
|