Commit 820d7c38 authored by 张彦钊's avatar 张彦钊

add print

parent b4ba9ec2
...@@ -24,9 +24,6 @@ LOCAL_DIRCTORY = "/Users/mac/utils/" ...@@ -24,9 +24,6 @@ LOCAL_DIRCTORY = "/Users/mac/utils/"
# 线上日记队列域名 # 线上日记队列域名
QUEUE_ONLINE_HOST = 'rm-m5e842126ng59jrv6.mysql.rds.aliyuncs.com' QUEUE_ONLINE_HOST = 'rm-m5e842126ng59jrv6.mysql.rds.aliyuncs.com'
# import pymysql
# db = pymysql.connect(host='rm-m5e842126ng59jrv6.mysql.rds.aliyuncs.com', port=3306, user='doris',passwd='o5gbA27hXHHm',
# db='doris_prod')
# 本地日记队列域名 # 本地日记队列域名
......
...@@ -179,7 +179,7 @@ def update_sql_dairy_queue(queue_name, diary_id,device_id, city_id): ...@@ -179,7 +179,7 @@ def update_sql_dairy_queue(queue_name, diary_id,device_id, city_id):
db='doris_prod') db='doris_prod')
else: else:
db = pymysql.connect(host=LOCAL_HOST, port=3306, user='work',passwd='workwork', db='doris_test') db = pymysql.connect(host=LOCAL_HOST, port=3306, user='work',passwd='workwork', db='doris_test')
print("bd")
cursor = db.cursor() cursor = db.cursor()
id_str = str(diary_id[0]) id_str = str(diary_id[0])
for i in range(1, len(diary_id)): for i in range(1, len(diary_id)):
...@@ -188,7 +188,9 @@ def update_sql_dairy_queue(queue_name, diary_id,device_id, city_id): ...@@ -188,7 +188,9 @@ def update_sql_dairy_queue(queue_name, diary_id,device_id, city_id):
sql = "update device_diary_queue set {}='{}' where device_id = '{}' and city_id = '{}'".format\ sql = "update device_diary_queue set {}='{}' where device_id = '{}' and city_id = '{}'".format\
(queue_name,id_str,device_id, city_id) (queue_name,id_str,device_id, city_id)
cursor.execute(sql) cursor.execute(sql)
print("1bd")
db.commit() db.commit()
print("2bd")
db.close() db.close()
print("成功写入diary_id") print("成功写入diary_id")
...@@ -216,23 +218,18 @@ def queue_compare(old_list, new_list): ...@@ -216,23 +218,18 @@ def queue_compare(old_list, new_list):
def get_queue(device_id, city_id,queue_name): def get_queue(device_id, city_id,queue_name):
if flag: if flag:
print("db")
db = pymysql.connect(host=QUEUE_ONLINE_HOST, port=3306, user='doris',passwd='o5gbA27hXHHm', db = pymysql.connect(host=QUEUE_ONLINE_HOST, port=3306, user='doris',passwd='o5gbA27hXHHm',
db='doris_prod') db='doris_prod')
print(db)
else: else:
db = pymysql.connect(host=LOCAL_HOST, port=3306, user='work', db = pymysql.connect(host=LOCAL_HOST, port=3306, user='work',
passwd='workwork', db='doris_test') passwd='workwork', db='doris_test')
cursor = db.cursor() cursor = db.cursor()
sql = "select {} from device_diary_queue " \ sql = "select {} from device_diary_queue " \
"where device_id = '{}' and city_id = '{}';".format(queue_name,device_id, city_id) "where device_id = '{}' and city_id = '{}';".format(queue_name,device_id, city_id)
cursor.execute(sql) cursor.execute(sql)
print("cursor")
result = cursor.fetchall() result = cursor.fetchall()
df = pd.DataFrame(list(result)) df = pd.DataFrame(list(result))
if df.empty: if df.empty:
print("该用户对应的日记为空") print("该用户对应的日记为空")
return False return False
......
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