python使用pymysql操作数据库
https://www.cnblogs.com/hanmk/p/9215387.html
https://www.cnblogs.com/liubinsh/p/7568423.html
https://www.cnblogs.com/xfxing/p/9322199.html
conn = pymysql.connect(host=DBHOST, user=DBUSER, password=DBPWD, database=DBNAME(数据库名字), charset="utf8")
mysql = conn.cursor(cursor=pymysql.cursors.DictCursor)
conn.ping(reconnect=True)
mysql.execute("select * from stable where id = %s and sc = %s", (rid, sc))
result = mysql.fetchone()
try:
mysql.scroll(0, mode='absolute')
except:
pass
--
conn.ping(reconnect=True)
mysql.execute("UPDATE stable SET FLAG = 1,DEL_FLAG = 0 WHERE ID = %s" % mn_id)
conn.commit()