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
bcfa4ecb
Commit
bcfa4ecb
authored
Aug 25, 2020
by
litaolemo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
d9608044
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
30 deletions
+47
-30
core_indicators_monitoring.py
task/core_indicators_monitoring.py
+47
-30
搜索日报-核心.sql
task/搜索日报-核心.sql
+0
-0
No files found.
task/core_indicators_monitoring.py
View file @
bcfa4ecb
...
@@ -80,17 +80,17 @@ SELECT
...
@@ -80,17 +80,17 @@ SELECT
,all_search_click_pv_724
,all_search_click_pv_724
,all_search_uv
,all_search_uv
,all_search_pv
,all_search_pv
,if(dau <> 0 ,c
oncat(cast((all_search_uv/dau)*100 as decimal(18,2)),'
%
') , '-'
)
,if(dau <> 0 ,c
ast((all_search_uv/dau) as decimal(18,2)) , 0
)
,if(all_search_uv <> 0 ,concat(cast((all_search_pv/all_search_uv) as decimal(18,
2)),'') , '-'
)
,if(all_search_uv <> 0 ,concat(cast((all_search_pv/all_search_uv) as decimal(18,
4)),'') , 0
)
,if(search_home_pv <> 0 ,c
oncat(cast((all_search_pv/search_home_pv)*100 as decimal(18,2)),'
%
') , '-'
)
,if(search_home_pv <> 0 ,c
ast((all_search_pv/search_home_pv) as decimal(18,4)) , 0
)
,if(sug_out_pv_726 <> 0 ,c
oncat(cast((sug_search_pv_726/sug_out_pv_726)*100 as decimal(18,2)),'
%
') , '-'
)
,if(sug_out_pv_726 <> 0 ,c
ast((sug_search_pv_726/sug_out_pv_726) as decimal(18,4)) , 0
)
,NVL(referrer_search_hexin_pv,0)
,NVL(referrer_search_hexin_pv,0)
,NVL(referrer_search_welfare_pv,0)
,NVL(referrer_search_welfare_pv,0)
,if(all_search_uv <> 0 ,concat(cast((referrer_search_hexin_pv/dau) as decimal(18,2)),'') ,
'-'
)
,if(all_search_uv <> 0 ,concat(cast((referrer_search_hexin_pv/dau) as decimal(18,2)),'') ,
0
)
,if(all_search_uv <> 0 ,concat(cast((referrer_search_neirong_pv/dau) as decimal(18,2)),'') ,
'-'
)
,if(all_search_uv <> 0 ,concat(cast((referrer_search_neirong_pv/dau) as decimal(18,2)),'') ,
0
)
,if(referrer_search_hexin_pv <> 0 ,c
oncat(cast((search_hexin_two_pv/dau)*100 as decimal(18,2)),'
%
') , '-'
)
,if(referrer_search_hexin_pv <> 0 ,c
ast((search_hexin_two_pv/dau)*100 as decimal(18,4)) , 0
)
,if(referrer_search_neirong_pv <> 0 ,c
oncat(cast((search_neirong_two_pv/dau)*100 as decimal(18,2)),'
%
') , '-'
)
,if(referrer_search_neirong_pv <> 0 ,c
ast((search_neirong_two_pv/dau)*100 as decimal(18,4)) , 0
)
,if(referrer_search_neirong_uv_1000 <> 0 ,concat(cast((referrer_search_neirong_pagestay/dau) as decimal(18,
2)),'') , '-'
)
,if(referrer_search_neirong_uv_1000 <> 0 ,concat(cast((referrer_search_neirong_pagestay/dau) as decimal(18,
4)),'') , 0
)
,NVL(referrer_search_neirong_pv,0)
,NVL(referrer_search_neirong_pv,0)
,NVL(search_hexin_two_pv,0)
,NVL(search_hexin_two_pv,0)
,NVL(search_neirong_two_pv,0)
,NVL(search_neirong_two_pv,0)
...
@@ -543,25 +543,42 @@ FROM
...
@@ -543,25 +543,42 @@ FROM
sql_res
=
device_df
.
collect
()
sql_res
=
device_df
.
collect
()
for
res
in
sql_res
:
for
res
in
sql_res
:
print
(
res
)
print
(
res
)
# device_type = res.device_type
partition_date
=
res
.
partition_date
# active_type = res.active_type
device_os_type
=
res
.
device_os_type
# channel_type = res.channel_type
active_type
=
res
.
device_os_type
# core_pv_division_uv = res.core_pv_division_uv
channel
=
res
.
channel
# pv_division_uv = res.pv_division_uv
dau
=
res
.
dau
# pid = hashlib.md5(
all_search_click_uv_724
=
res
.
all_search_click_uv_724
# (today_str + device_type + active_type + channel_type).encode("utf8")).hexdigest()
all_search_click_pv_724
=
res
.
all_search_click_pv_724
# instert_sql = """replace into search_strategy_d(
all_search_uv
=
res
.
all_search_uv
# day_id,device_type,active_type,channel_type,core_pv_division_uv,pv_division_uv,pid
all_search_pv
=
res
.
all_search_pv
# ) VALUES('{day_id}','{device_type}','{active_type}','{channel_type}',{core_pv_division_uv},{pv_division_uv},'{pid}');""".format(
completed_user_rate
=
res
.
completed_user_rate
# day_id=today_str, device_type=device_type,
per_user_search_count
=
res
.
per_user_search_count
# active_type=active_type, channel_type=channel_type, core_pv_division_uv=core_pv_division_uv,
search_success_rate
=
res
.
search_success_rate
# pv_division_uv=pv_division_uv, pid=pid
sug_uesd_rate
=
res
.
sug_uesd_rate
#
referrer_search_hexin_pv
=
res
.
referrer_search_hexin_pv
# )
referrer_search_welfare_pv
=
res
.
referrer_search_welfare_pv
# print(instert_sql)
search_core_pv_div_dau
=
res
.
search_core_pv_div_dau
# # cursor.execute("set names 'UTF8'")
search_core_two_div_dau
=
res
.
search_core_two_div_dau
# res = cursor.execute(instert_sql)
search_neirong_two_div_dau
=
res
.
search_neirong_two_div_dau
# db.commit()
search_neirong_per_duration
=
res
.
search_neirong_per_duration
# print(res)
referrer_search_neirong_pv
=
res
.
referrer_search_neirong_pv
# db.close()
pid
=
hashlib
.
md5
((
partition_date
+
device_os_type
+
active_type
+
channel
)
.
encode
(
"utf8"
))
.
hexdigest
()
instert_sql
=
"""replace into core_indicators_monitoring(
partition_date,device_os_type,active_type,channel,dau,all_search_click_uv_724,all_search_click_pv_724,all_search_uv,all_search_pv,completed_user_rate,per_user_search_count,
search_success_rate,sug_uesd_rate,referrer_search_hexin_pv,referrer_search_welfare_pv,search_core_pv_div_dau,search_core_two_div_dau,search_neirong_two_div_dau,search_neirong_per_duration,referrer_search_neirong_pv,pid
) VALUES('{partition_date}','{device_os_type}','{active_type}','{channel}',{dau},{all_search_click_uv_724},{all_search_click_pv_724},{all_search_uv},{all_search_pv},{completed_user_rate},{per_user_search_count},
{search_success_rate},{sug_uesd_rate},{referrer_search_hexin_pv},{referrer_search_welfare_pv},{search_core_pv_div_dau},{search_core_two_div_dau},{search_neirong_two_div_dau},{search_neirong_per_duration},{referrer_search_neirong_pv},'{pid}');"""
.
format
(
partition_date
=
partition_date
,
device_os_type
=
device_os_type
,
active_type
=
active_type
,
channel
=
channel
,
dau
=
dau
,
all_search_click_uv_724
=
all_search_click_uv_724
,
all_search_click_pv_724
=
all_search_click_uv_724
,
all_search_uv
=
all_search_uv
,
all_search_pv
=
all_search_pv
,
completed_user_rate
=
completed_user_rate
,
per_user_search_count
=
per_user_search_count
,
search_success_rate
=
search_success_rate
,
sug_uesd_rate
=
sug_uesd_rate
,
referrer_search_hexin_pv
=
referrer_search_hexin_pv
,
referrer_search_welfare_pv
=
referrer_search_welfare_pv
,
search_core_pv_div_dau
=
search_core_pv_div_dau
,
search_core_two_div_dau
=
search_core_two_div_dau
,
search_neirong_two_div_dau
=
search_neirong_two_div_dau
,
search_neirong_per_duration
=
search_neirong_per_duration
,
referrer_search_neirong_pv
=
referrer_search_neirong_pv
,
pid
=
pid
)
print
(
instert_sql
)
# cursor.execute("set names 'UTF8'")
res
=
cursor
.
execute
(
instert_sql
)
db
.
commit
()
print
(
res
)
db
.
close
()
task/搜索日报-核心.sql
0 → 100644
View file @
bcfa4ecb
This diff is collapsed.
Click to expand it.
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