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
1d8d3a70
Commit
1d8d3a70
authored
Dec 01, 2020
by
litaolemo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
e750dde5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
22 deletions
+14
-22
new_user_word_count.py
new_user_analysis/new_user_word_count.py
+14
-22
No files found.
new_user_analysis/new_user_word_count.py
View file @
1d8d3a70
...
...
@@ -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))
#
...
...
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