Commit acce07e8 authored by 张彦钊's avatar 张彦钊

add test

parent 877ac1ae
...@@ -39,10 +39,8 @@ def get_local_device(): ...@@ -39,10 +39,8 @@ def get_local_device():
df.to_csv('/Users/mac/utils/test_device_city_id.csv', index=None) df.to_csv('/Users/mac/utils/test_device_city_id.csv', index=None)
print(1) print(1)
def save_queue():
id = 334 def save_queue(id,device_id,city_id):
device_id = '00CA20EB-2719-4518-85CC-60E765AC526F'
city_id = 'beijing'
queue_name_list = ["native_queue", "nearby_queue", "nation_queue", "megacity_queue"] queue_name_list = ["native_queue", "nearby_queue", "nation_queue", "megacity_queue"]
for i in queue_name_list: for i in queue_name_list:
sql = "select {} from device_diary_queue " \ sql = "select {} from device_diary_queue " \
...@@ -59,6 +57,17 @@ def save_queue(): ...@@ -59,6 +57,17 @@ def save_queue():
df.to_csv("/data/models/{}.csv".format(i), index=None) df.to_csv("/data/models/{}.csv".format(i), index=None)
print("end") print("end")
def delete():
db = pymysql.connect(host='rm-m5e842126ng59jrv6.mysql.rds.aliyuncs.com', port=3306, user='doris',
passwd='o5gbA27hXHHm',
db='doris_prod')
cursor = db.cursor()
sql = "delete from device_diary_queue where device_id = '{}' and city_id = '{}';".format(device_id, city_id)
cursor.execute(sql)
db.close()
print("shan")
def insert(id,device_id,city_id): def insert(id,device_id,city_id):
queue_name_list = ["native_queue", "nearby_queue", "nation_queue", "megacity_queue"] queue_name_list = ["native_queue", "nearby_queue", "nation_queue", "megacity_queue"]
a = {} a = {}
...@@ -78,7 +87,10 @@ def insert(id,device_id,city_id): ...@@ -78,7 +87,10 @@ def insert(id,device_id,city_id):
print("end") print("end")
if __name__=="__main__": if __name__=="__main__":
# 先把数据保存下来,调用上面的save函数,
id = 334 id = 334
device_id = '00CA20EB-2719-4518-85CC-60E765AC526F' device_id = '00CA20EB-2719-4518-85CC-60E765AC526F'
city_id = 'beijing' city_id = 'beijing'
...@@ -91,10 +103,3 @@ if __name__=="__main__": ...@@ -91,10 +103,3 @@ if __name__=="__main__":
# 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