Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
meta_base_code
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
宋柯
meta_base_code
Commits
8f5393f7
Commit
8f5393f7
authored
Sep 04, 2020
by
litaolemo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
9ac2998f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
search_strategy_d.py
task/search_strategy_d.py
+7
-3
No files found.
task/search_strategy_d.py
View file @
8f5393f7
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment