Commit 9b407442 authored by litaolemo's avatar litaolemo

update

parent a62757b6
...@@ -89,7 +89,7 @@ grey_select_sql = """SELECT *, ...@@ -89,7 +89,7 @@ grey_select_sql = """SELECT *,
NVL(ROUND(card_click/card_exposure,5),0) as click_ctr, NVL(ROUND(card_click/card_exposure,5),0) as click_ctr,
NVL(ROUND((navbar_search+highlight_word+self_welfare_card+recommend_welfare_card+recommend_content_card*0.2+transfer_card+video_consultation)/card_click,5),0) as second_jump_ctr , NVL(ROUND((navbar_search+highlight_word+self_welfare_card+recommend_welfare_card+recommend_content_card*0.2+transfer_card+video_consultation)/card_click,5),0) as second_jump_ctr ,
NVL(ROUND(page_pv_20/page_pv,5),0) as page_pv_20_percent NVL(ROUND(page_pv_20/page_pv,5),0) as page_pv_20_percent
FROM pm.tl_pm_recommend_strategy_d_v2 where day_id >= {day_id}""".format(day_id=one_week_age_str) FROM pm.tl_pm_recommend_strategy_d_v2"""
device_df = spark.sql(grey_select_sql) device_df = spark.sql(grey_select_sql)
device_df.show(1, False) device_df.show(1, False)
...@@ -127,7 +127,7 @@ for res in sql_res: ...@@ -127,7 +127,7 @@ for res in sql_res:
click_ctr = res.click_ctr click_ctr = res.click_ctr
pid = hashlib.md5((day_id + device_os_type + active_type + card_content_type + recommend_type).encode("utf8")).hexdigest() pid = hashlib.md5((day_id + device_os_type + active_type + card_content_type + recommend_type).encode("utf8")).hexdigest()
instert_sql = """replace into recommend_strategy_d( instert_sql = """replace into recommend_strategy_d(
day_id,device_os_type,active_type,card_content_type,recommend_type,card_click,card_exposure,navbar_search, day_id,device_os_type,active_type,card_content_type,recommend_type,card_click,card_exposure,avg_page_stay,navbar_search,
highlight_word,self_welfare_card,recommend_welfare_card,recommend_content_card,recommend_special_card,transfer_card,video_consultation, highlight_word,self_welfare_card,recommend_welfare_card,recommend_content_card,recommend_special_card,transfer_card,video_consultation,
partition_day,pid,recommend_ctr,second_jump_ctr,click_ctr,page_pv_20_percent partition_day,pid,recommend_ctr,second_jump_ctr,click_ctr,page_pv_20_percent
) VALUES('{day_id}','{device_os_type}','{active_type}','{card_content_type}','{recommend_type}',{card_click},{card_exposure}, ) VALUES('{day_id}','{device_os_type}','{active_type}','{card_content_type}','{recommend_type}',{card_click},{card_exposure},
......
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