Commit 0d3edf10 authored by litaolemo's avatar litaolemo

update

parent 6a0a92b1
......@@ -91,11 +91,15 @@ for t in range(2, task_days):
yesterday_str_format = (now + datetime.timedelta(days=-1)).strftime("%Y-%m-%d")
one_week_age_str = (now + datetime.timedelta(days=-7)).strftime("%Y%m%d")
new_urser_device_id_sql = r"""
select cl_type,app_version,count(app_version) as count_num from
( select *,rank() over(partition by cl_id order by partition_date desc) as ranking from
(select cl_type,app_version,cl_id,partition_date from online.bl_hdfs_maidian_updates where partition_date >= "20200201" group by cl_type,app_version,cl_id,partition_date)
) where ranking =1 group by cl_type,app_version
""".format(start_date="20210101", end_date="20200222", today_str_format=today_str_format,tomorrow_str=tomorrow_str)
SELECT *
FROM online.bl_hdfs_maidian_updates
WHERE partition_date >= '{partition_day}'
AND partition_date < '{end_date}'
AND ((action in ('on_click_topic_card','on_click_diary_card','search_result_click_infomation_item')
AND page_name in ('search_result_more','search_result_diary','search_result_post'))
or (action = 'on_click_card' AND params['card_content_type'] in ('answer','diary') AND page_name in ('search_result_more','search_result_diary','search_result_question_answer')))
limit 200
""".format(partition_day="20210101", end_date="20200102",tomorrow_str=tomorrow_str)
# print(new_urser_device_id_sql)
new_urser_device_id_df = spark.sql(new_urser_device_id_sql)
......
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