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
862 B
17 lines
862 B
|
15 hours ago
|
# -*- 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}')
|