# -*- coding: utf-8 -*- """票 04 数据态核查 v4:followFuture 跟进 + stage2 名单""" import pymysql conn = pymysql.connect(host='8.129.84.155', user='root', password='Itc@123456', database='crm', charset='utf8mb4', autocommit=True) cur = conn.cursor(pymysql.cursors.DictCursor) cur.execute('SHOW COLUMNS FROM customer_follow') print('FOLLOW COLS:', [r['Field'] for r in cur.fetchall()]) cur.execute("SELECT follow_content, next_follow_time, deleted, create_time " "FROM customer_follow WHERE customer_id='750844480352944128' " "ORDER BY create_time DESC LIMIT 5") print('followFuture follows:') for r in cur.fetchall(): print(' ', r['create_time'], 'next=', r['next_follow_time'], 'deleted=', r['deleted'], str(r['follow_content'])[:30]) cur.execute("SELECT customer_name, owner_user_id FROM customer " "WHERE customer_stage=2 AND archive_status=1 ORDER BY customer_name") print('stage=2 active:') for r in cur.fetchall(): print(' ', r['customer_name'], 'owner=', r['owner_user_id']) conn.close() print('DONE')