# -*- coding: utf-8 -*- """diag-cols.py — customer 表 owner 相关列 + collab 行现值""" 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("SHOW COLUMNS FROM customer WHERE Field LIKE 'owner%'") for r in cur.fetchall(): print('col:', r['Field'], r['Type']) cur.execute("SELECT * FROM customer WHERE id='750844482391375872'") row = cur.fetchone() or {} for k, v in row.items(): if 'owner' in k or 'dept' in k or k in ('id', 'customer_name', 'archive_status'): print(f'{k} = {v}')