20 lines
1.5 KiB
Python
20 lines
1.5 KiB
Python
import pymysql
|
|
conn=pymysql.connect(host='218.93.191.20',port=3306,user='read_only_jiansun',password='^9B%@iQJESZrR!',db='jiansunblueprint',charset='utf8mb4',autocommit=True)
|
|
cur=conn.cursor()
|
|
cases = [
|
|
("select `sku(货号)`,`工厂条形码`,`图纸ID`,`SKU型号` from sheet1 where `sku(货号)` like %s limit 20", ("%DSG003919%",), "sheet1 like DSG003919"),
|
|
("select `sku(货号)`,`工厂条形码`,`图纸ID`,`SKU型号` from sheet1 where `sku(货号)` like %s limit 20", ("%DSG0039%",), "sheet1 like DSG0039"),
|
|
("select id,taskId,SPU,picture,pictureId,skucodes,withInstructions,withVideo,createdTime from missiontask where skucodes like %s limit 20", ("%DSG003919%",), "missiontask skucodes like DSG003919"),
|
|
("select id,taskId,SPU,picture,pictureId,skucodes,withInstructions,withVideo,createdTime from missiontask where skucodes like %s limit 20", ("%DSG0039%",), "missiontask skucodes like DSG0039"),
|
|
("select id,hid,url,orderNum from missiontask_instructions where hid in (select id from missiontask where skucodes like %s limit 20) limit 40", ("%DSG0039%",), "instructions via missiontask"),
|
|
("select id,hid,url,orderNum from missiontask_video where hid in (select id from missiontask where skucodes like %s limit 20) limit 40", ("%DSG0039%",), "video via missiontask"),
|
|
]
|
|
for sql, params, title in cases:
|
|
print(f"\n=== {title} ===")
|
|
cur.execute(sql, params)
|
|
rows = cur.fetchall()
|
|
print('rows', len(rows))
|
|
for r in rows[:10]:
|
|
print(r)
|
|
cur.close(); conn.close()
|