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

change test

parent 81ce2fe8
......@@ -7,9 +7,7 @@ def con_sql(db,sql):
cursor = db.cursor()
cursor.execute(sql)
result = cursor.fetchone()
print(result)
print(result[0])
result = cursor.fetchone()[0]
db.close()
return result
......@@ -18,13 +16,13 @@ def get_ctr():
db = pymysql.connect(host='172.16.40.158', port=4000, user='root', passwd='3SYz54LS9#^9sBvC', db='jerry_prod')
yesterday = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y-%m-%d")
print(yesterday)
sql = "select count(*) from data_feed_exposure_precise where stat_date = '{}'".format(yesterday)
sql = "select count(*) from data_feed_exposure_precise where stat_date = '{}' and cid_type = 'diary'".format(yesterday)
exposures = con_sql(db, sql)
# sql = "select count(*) from data_feed_click where stat_date = '{}'".format(yesterday)
# clicks = con_sql(db, sql)
# print(exposures)
# print(clicks)
# print(exposures/clicks)
sql = "select count(*) from data_feed_click where stat_date = '{}' and cid_type = 'diary'".format(yesterday)
clicks = con_sql(db, sql)
print(exposures)
print(clicks)
print(clicks/exposures)
......
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