import pymysql conn = pymysql.connect(host='123.60.180.165', port=3306, user='aidopremote', password='1234567890aiDOP#', charset='utf8mb4', autocommit=True) try: with conn.cursor() as cur: cur.execute("SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='aidopdev' AND table_name LIKE 'ado\\_%'") c = cur.fetchone()[0] print(f"ado_* table count: {c}") cur.execute("SELECT table_name FROM information_schema.tables WHERE table_schema='aidopdev' AND table_name LIKE 'ado\\_%' ORDER BY table_name") rows = [r[0] for r in cur.fetchall()] for r in rows: print(r) finally: conn.close()