Commit 1d8d3a70 authored by litaolemo's avatar litaolemo

update

parent e750dde5
...@@ -94,19 +94,13 @@ for t in range(0, task_days): ...@@ -94,19 +94,13 @@ for t in range(0, task_days):
sql_search_ctr = r""" sql_search_ctr = r"""
select t0.device_id as device_id,click.query from
( --搜索pvuv
(select device_id from online.ml_device_day_active_status where partition_date = '{today_str}' and active_type in (1,2))t2 SELECT query
LEFT JOIN partition_date,
( cl_id
select distinct device_id FROM (
from ML.ML_D_CT_DV_DEVICECLEAN_DIMEN_D SELECT cl_id,
where PARTITION_DAY = '{today_str}'
AND is_abnormal_device = 'true'
)dev
on t2.device_id=dev.device_id
WHERE dev.device_id is null and t2.device_id is not null) t0 left join
( SELECT cl_id,
partition_date, partition_date,
action, action,
params['page_name'] as page_name, params['page_name'] as page_name,
...@@ -118,7 +112,7 @@ WHERE dev.device_id is null and t2.device_id is not null) t0 left join ...@@ -118,7 +112,7 @@ WHERE dev.device_id is null and t2.device_id is not null) t0 left join
AND partition_date < '{end_date}' AND partition_date < '{end_date}'
AND ((action = 'do_search' AND params['input_type'] <> 'everyone_watch') or AND ((action = 'do_search' AND params['input_type'] <> 'everyone_watch') or
action = 'search_result_click_search') action = 'search_result_click_search')
UNION all UNION all
SELECT cl_id, SELECT cl_id,
partition_date, partition_date,
...@@ -135,7 +129,7 @@ WHERE dev.device_id is null and t2.device_id is not null) t0 left join ...@@ -135,7 +129,7 @@ WHERE dev.device_id is null and t2.device_id is not null) t0 left join
and params['tab'] = '精选' and params['tab'] = '精选'
and page_name = 'home' and page_name = 'home'
AND params['query'] not in ('AI测颜值', 'AI测肤质') --这两个词不跳转搜索结果页 AND params['query'] not in ('AI测颜值', 'AI测肤质') --这两个词不跳转搜索结果页
union all union all
SELECT cl_id, SELECT cl_id,
partition_date, partition_date,
...@@ -149,7 +143,7 @@ WHERE dev.device_id is null and t2.device_id is not null) t0 left join ...@@ -149,7 +143,7 @@ WHERE dev.device_id is null and t2.device_id is not null) t0 left join
AND partition_date < '{end_date}' AND partition_date < '{end_date}'
AND action = 'on_click_card' AND action = 'on_click_card'
AND params['page_name'] = 'search_home' AND params['page_name'] = 'search_home'
union all union all
SELECT cl_id, SELECT cl_id,
partition_date, partition_date,
...@@ -167,7 +161,7 @@ WHERE dev.device_id is null and t2.device_id is not null) t0 left join ...@@ -167,7 +161,7 @@ WHERE dev.device_id is null and t2.device_id is not null) t0 left join
AND params['card_type'] = 'search_word' AND params['card_type'] = 'search_word'
AND params['card_name'] not in ('AI测颜值', 'AI测肤质') --这两个词不跳转搜索结果页 AND params['card_name'] not in ('AI测颜值', 'AI测肤质') --这两个词不跳转搜索结果页
--AND page_name='home' android的page_name为空 --AND page_name='home' android的page_name为空
union all union all
SELECT cl_id, SELECT cl_id,
partition_date, partition_date,
...@@ -183,7 +177,7 @@ WHERE dev.device_id is null and t2.device_id is not null) t0 left join ...@@ -183,7 +177,7 @@ WHERE dev.device_id is null and t2.device_id is not null) t0 left join
AND params['page_name'] = 'welfare_home' AND params['page_name'] = 'welfare_home'
AND params['card_type'] = 'search_word' AND params['card_type'] = 'search_word'
AND params['in_page_pos'] = '大家都在搜' AND params['in_page_pos'] = '大家都在搜'
union all union all
SELECT cl_id, SELECT cl_id,
partition_date, partition_date,
...@@ -198,8 +192,6 @@ WHERE dev.device_id is null and t2.device_id is not null) t0 left join ...@@ -198,8 +192,6 @@ WHERE dev.device_id is null and t2.device_id is not null) t0 left join
AND action = 'on_click_card' AND action = 'on_click_card'
AND params['card_type'] = 'highlight_word' AND params['card_type'] = 'highlight_word'
) click ) click
on click.cl_id=t0.device_id
""".format(start_date=yesterday_str, end_date=today_str,today_str=yesterday_str) """.format(start_date=yesterday_str, end_date=today_str,today_str=yesterday_str)
...@@ -211,9 +203,9 @@ WHERE dev.device_id is null and t2.device_id is not null) t0 left join ...@@ -211,9 +203,9 @@ WHERE dev.device_id is null and t2.device_id is not null) t0 left join
for name in sql_res: for name in sql_res:
# print(name) # print(name)
word = name.query word = name.query
doc_id = name.device_id cl_id = name.cl_id
if "发型" in word: if "发型" in word:
print(word,doc_id) print(word,cl_id)
# partition_date = str(now + datetime.timedelta(days=-1)) # partition_date = str(now + datetime.timedelta(days=-1))
# tag_names_list_week.append((word, nums, uv, partition_date)) # tag_names_list_week.append((word, nums, uv, partition_date))
# #
......
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