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.

24 lines
815 B

7 days ago
# -*- coding: utf-8 -*-
# t11-tables.py — 规则族/模板族/地区表名实锤(只读 SHOW TABLES)
import io, sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
import pymysql
conn = pymysql.connect(host='8.129.84.155', port=3306, user='root', password='Itc@123456',
database='crm', charset='utf8mb4')
cur = conn.cursor()
cur.execute('SHOW TABLES')
names = [r[0] for r in cur.fetchall()]
for n in names:
if any(k in n for k in ('rule', 'templ', 'region', 'stage')):
print(n)
conn.close()
print('---')
for t in ('opportunity_pool_rule_dept',):
try:
cur.execute('SELECT rule_version_id, dept_id FROM %s LIMIT 20' % t)
for r in cur.fetchall():
print(t, r)
except Exception as e:
print(t, 'ERR', e)
conn.close()