Commit 8f5393f7 authored by litaolemo's avatar litaolemo

update

parent 9ac2998f
...@@ -81,13 +81,15 @@ for t in range(1, task_days): ...@@ -81,13 +81,15 @@ for t in range(1, task_days):
yesterday_str = (now + datetime.timedelta(days=-1)).strftime("%Y%m%d") yesterday_str = (now + datetime.timedelta(days=-1)).strftime("%Y%m%d")
one_week_age_str = (now + datetime.timedelta(days=-7)).strftime("%Y%m%d") one_week_age_str = (now + datetime.timedelta(days=-7)).strftime("%Y%m%d")
sql_distinct_device_id = """ sql_distinct_device_id = """
SELECT DISTINCT device_id select spam_pv.device_id as spam_pv_device_id,dev.device_id as dev_device_id from
(SELECT DISTINCT device_id
FROM ml.ml_d_ct_dv_devicespam_d --去除机构刷单设备,即作弊设备(浏览和曝光事件去除) FROM ml.ml_d_ct_dv_devicespam_d --去除机构刷单设备,即作弊设备(浏览和曝光事件去除)
WHERE partition_day={yesterday_str} WHERE partition_day={yesterday_str}
UNION ALL UNION ALL
SELECT DISTINCT dev.device_id SELECT DISTINCT dev.device_id
FROM dim.dim_device_user_staff --去除内网用户 FROM dim.dim_device_user_staff --去除内网用户
)spam_pv
LEFT JOIN LEFT JOIN
( (
SELECT partition_date,t1.device_id SELECT partition_date,t1.device_id
...@@ -257,7 +259,8 @@ FROM ...@@ -257,7 +259,8 @@ FROM
LEFT JOIN distinct_device_id_view LEFT JOIN distinct_device_id_view
on t1.cl_id=distinct_device_id_view.device_id on t1.cl_id=distinct_device_id_view.device_id
WHERE (distinct_device_id_view.device_id IS NULL or distinct_device_id_view.device_id ='') WHERE (distinct_device_id_view.dev_device_id IS NULL or distinct_device_id_view.dev_device_id ='')
and (distinct_device_id_view.spam_pv_device_id is null or distinct_device_id_view.spam_pv_device_id ='')
GROUP BY t1.partition_date,t2.active_type,device_os_type,channel GROUP BY t1.partition_date,t2.active_type,device_os_type,channel
)t )t
)t3 )t3
...@@ -349,7 +352,8 @@ LEFT JOIN ...@@ -349,7 +352,8 @@ LEFT JOIN
on t1.cl_id=dev.device_id and t1.partition_date = dev.partition_date on t1.cl_id=dev.device_id and t1.partition_date = dev.partition_date
LEFT JOIN distinct_device_id_view LEFT JOIN distinct_device_id_view
on t1.cl_id=distinct_device_id_view.device_id on t1.cl_id=distinct_device_id_view.device_id
WHERE (distinct_device_id_view.device_id IS NULL or distinct_device_id_view.device_id ='') WHERE (distinct_device_id_view.dev_device_id IS NULL or distinct_device_id_view.dev_device_id ='')
and (distinct_device_id_view.spam_pv_device_id is null or distinct_device_id_view.spam_pv_device_id ='')
GROUP BY t1.partition_date,active_type,device_os_type,channel GROUP BY t1.partition_date,active_type,device_os_type,channel
)t4 )t4
on t3.partition_date=t4.partition_date and t3.active_type=t4.active_type and t3.device_os_type = t4.device_os_type AND t3.channel = t4.channel on t3.partition_date=t4.partition_date and t3.active_type=t4.active_type and t3.device_os_type = t4.device_os_type AND t3.channel = t4.channel
......
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