# -*- coding: utf-8 -*- import pymysql conn = pymysql.connect(host='8.129.84.155', port=3306, user='root', password='Itc@123456', database='crm', charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor) with conn.cursor() as cur: cur.execute('SELECT leader_user_id FROM sys_dept WHERE id=744700334353416192') print('dept leader restored:', cur.fetchall()) cur.execute('SELECT dept_id FROM crm_auth_user WHERE id=744842318024015872') print('BUDDY dept restored:', cur.fetchall()) cur.execute("SELECT COUNT(*) c FROM customer WHERE owner_user_id=744842318024015872 AND deleted=0 AND archive_status=1") print('BUDDY active owned:', cur.fetchall()) cur.execute("SELECT COUNT(*) c FROM customer WHERE customer_name LIKE 'e2c-r3d%'") print('residual fixtures:', cur.fetchall()) cur.execute("SELECT COUNT(*) c FROM customer_transfer WHERE from_user_id=744842318024015872 AND create_time>=CURDATE()") print('residual BUDDY transfers today:', cur.fetchall()) conn.close()