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.

17 lines
1.0 KiB

19 hours ago
# -*- coding: utf-8 -*-
"""diag-defix.py — defix 手工样例终态核实"""
import io, sys, pymysql
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
conn = pymysql.connect(host='8.129.84.155', port=3306, user='root', password='Itc@123456',
database='crm', charset='utf8mb4', autocommit=True,
connect_timeout=10, cursorclass=pymysql.cursors.DictCursor)
with conn.cursor() as cur:
cur.execute("SELECT id, customer_no, customer_name, archive_status, create_time "
"FROM customer WHERE customer_no LIKE 'E2C-DEFIX%' OR customer_name LIKE '%defix%'")
for r in cur.fetchall():
print(r['id'], r['customer_no'], r['customer_name'], 'arch=', r['archive_status'], r['create_time'])
cur.execute("SELECT COUNT(*) c FROM customer WHERE customer_name LIKE 'e2c-%'")
print('e2c-% total =', cur.fetchone()['c'])
cur.execute("SELECT COUNT(*) c FROM customer WHERE customer_name LIKE 'e2c-%' AND archive_status=0")
print('e2c-% active(all incl seed) =', cur.fetchone()['c'])