Commit 71ef6cfc authored by litaolemo's avatar litaolemo

update

parent 4ad33c30
......@@ -189,9 +189,10 @@ WHERE spam_pv.device_id IS NULL
"projects": {},
'anecdote_tags':{}
}
no_portrait_device_id_list = []
print("-------------------------------")
count_not_has_portratit = 0
for count_user_count, res in enumerate(sql_res):
# print(count, res)
portratit_res = get_user_portrait_tag3_from_redis(res.device_id)
......@@ -212,34 +213,30 @@ WHERE spam_pv.device_id IS NULL
temp_count += 1
if not temp_count:
count_not_has_portratit += 1
no_portrait_device_id_list.append(res.device_id)
print(portrait_dict)
print(count_user_count+1,count_not_has_portratit)
print("-------------------------------")
# for action in res_dict:
# partition_date = yesterday_str
# pid = hashlib.md5((partition_date + action).encode("utf8")).hexdigest()
# action_count = res_dict[action]
# action_ch = name_dict.get(action)
# if not action_ch:
# action_ch = action
# if action_ch in exception_list:
# continue
# instert_sql = """replace into new_user_click_count(
# partition_day,pid,action_count,action_ch,action) VALUES('{partition_day}','{pid}',{action_count},'{action_ch}','{action}');""".format(
# partition_date=partition_date, partition_day=yesterday_str, pid=pid, action_count=action_count,
# action_ch=action_ch, action=action
# )
# print(instert_sql)
# # cursor.execute("set names 'UTF8'")
# db = pymysql.connect(host='172.16.40.158', port=4000, user='st_user', passwd='aqpuBLYzEV7tML5RPsN1pntUzFy',
# db='jerry_prod')
# cursor = db.cursor()
# res = cursor.execute(instert_sql)
# db.commit()
# print(res)
# # cursor.executemany()
# db.close()
portrait_dict["second_demands"]["no_portratit"] = count_not_has_portratit
for protratit_type in portrait_dict["second_demands"]:
partition_date = today_str
pid = hashlib.md5((partition_date + protratit_type).encode("utf8")).hexdigest()
action_count = res_dict[protratit_type]
instert_sql = """replace into new_user_protratit_count(
partition_day,pid,protratit_count,protratit_type) VALUES('{partition_day}','{pid}',{protratit_count},'{protratit_type}');""".format(
partition_day=today_str, pid=pid, protratit_count=portrait_dict["second_demands"][protratit_type]
, protratit_type=protratit_type
)
print(instert_sql)
# cursor.execute("set names 'UTF8'")
db = pymysql.connect(host='172.16.40.158', port=4000, user='st_user', passwd='aqpuBLYzEV7tML5RPsN1pntUzFy',
db='jerry_prod')
cursor = db.cursor()
res = cursor.execute(instert_sql)
db.commit()
print(res)
# cursor.executemany()
db.close()
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