Commit 1d8d3a70 authored by litaolemo's avatar litaolemo

update

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