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
869 B

# -*- coding: utf-8 -*-
import pymysql, io, sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', line_buffering=True)
conn = pymysql.connect(host='8.129.84.155', port=3306, user='root', password='Itc@123456',
database='crm', charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor)
cur = conn.cursor()
cur.execute("SHOW TABLES LIKE 'sys%%'")
print('sys tables:', [r[list(r)[0]] for r in cur.fetchall()])
try:
cur.execute("SELECT id, name, dept_id, enabled, employment_status FROM sys_user WHERE id IN (739564171091247104, 744842318024015872)")
for r in cur.fetchall(): print('user:', r)
except Exception as e: print('sys_user ERR', e)
try:
cur.execute("SELECT id, dept_name, leader_user_id FROM sys_dept")
for r in cur.fetchall(): print('dept:', r)
except Exception as e: print('sys_dept ERR', e)
conn.close()