Commit 014bedfa authored by 张彦钊's avatar 张彦钊

如果日记队列顺序没有发生变化,就不更新数据库了

parent 102aea36
...@@ -30,50 +30,7 @@ QUEUE_ONLINE_HOST = 'rm-m5e842126ng59jrv6.mysql.rds.aliyuncs.com' ...@@ -30,50 +30,7 @@ QUEUE_ONLINE_HOST = 'rm-m5e842126ng59jrv6.mysql.rds.aliyuncs.com'
LOCAL_HOST = 'rdsmaqevmuzj6jy.mysql.rds.aliyuncs.com' LOCAL_HOST = 'rdsmaqevmuzj6jy.mysql.rds.aliyuncs.com'
# import pymysql
# import pandas as pd
# device_id = "16CFD2C4-B965-42C8-8ADD-7BDC22D6CC57"
# city = "wuhan"
# queue_name_list = ["native_queue","nearby_queue","nation_queue","megacity_queue"]
# for i in queue_name_list:
#
# sql = "select {} from device_diary_queue " \
# "where device_id = '{}' and city_id = '{}';".format(i,device_id, city)
#
# db = pymysql.connect(host='rm-m5e842126ng59jrv6.mysql.rds.aliyuncs.com', port=3306, user='doris',passwd='o5gbA27hXHHm',
# db='doris_prod')
# # sql = "select device_id,city_id,native_queue,nearby_queue,nation_queue,megacity_queue,get_diary_time,id from device_diary_queue" \
# # "where device_id = {} and city_id = {};".format(device_id,city)
# cursor = db.cursor()
# cursor.execute(sql)
# result = cursor.fetchall()
# df = pd.DataFrame(list(result))
# print(df.shape)
# df.to_csv("/data2/models/{}.csv".format(i),index=None)
# print("end")
import pandas as pd
queue_name_list = ["native_queue","nearby_queue","nation_queue","megacity_queue"]
id = 9454
device_id = "16CFD2C4-B965-42C8-8ADD-7BDC22D6CC57"
city_id = "wuhan"
a = {}
for i in queue_name_list:
a[i] = pd.read_csv("/data2/models/native_queue.csv")["0"].values.tolist()[0]
db = pymysql.connect(host='rm-m5e842126ng59jrv6.mysql.rds.aliyuncs.com', port=3306, user='doris',passwd='o5gbA27hXHHm',
db='doris_prod')
sql = "update device_diary_queue set {}='{}' where device_id = '{}' and city_id = '{}'".format\
(i,a[i],device_id,city_id)
cursor = db.cursor()
cursor.execute(sql)
db.commit()
db.close()
print("end")
# native_queue,nearby_queue,nation_queue,megacity_queue,
# a['native_queue'],a['nearby_queue'],a['nation_queue'],a['megacity_queue'],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment