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

修改了sql语句

parent 771c41cb
......@@ -15,7 +15,7 @@ def get_yesterday_date():
def get_data():
conn2db = pymysql.connect(host='10.66.157.22', port=4000, user='root', passwd='3SYz54LS9#^9sBvC', db='eagle')
cursor = conn2db.cursor()
sql = "select device_id from ffm_diary_queue_temp where device_id regexp '[5|6]$'"
sql = "select distinct device_id from ffm_diary_queue_temp where device_id regexp '[5|6]$'"
cursor.execute(sql)
result = cursor.fetchall()
device = tuple(pd.DataFrame(list(result))[0].values.tolist())
......@@ -70,8 +70,8 @@ def ctr():
click = cursor.fetchone()[0]
print("实验用户点击数:"+str(click))
sql_exp = "select count(cid) from data_feed_exposure " \
"where (cid_type = 'diary' or cid_type = 'diary_video') and stat_date = '{}' and " \
"device_id in {}".format(date,device_id)
"where (cid_type = 'diary' or cid_type = 'diary_video') " \
"and stat_date = '{}' and device_id in {}".format(date,device_id)
cursor.execute(sql_exp)
exp = cursor.fetchone()[0]
print("实验用户曝光数:"+str(exp))
......
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