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
696dc393
Commit
696dc393
authored
Sep 07, 2020
by
litaolemo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
be777834
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
search_meigou_ctr.py
task/search_meigou_ctr.py
+4
-4
No files found.
task/search_meigou_ctr.py
View file @
696dc393
...
@@ -213,8 +213,8 @@ and (dev.device_id is null or dev.device_id='')
...
@@ -213,8 +213,8 @@ and (dev.device_id is null or dev.device_id='')
for
active_type
in
res_dict
:
for
active_type
in
res_dict
:
for
device_os_type
in
res_dict
[
active_type
]:
for
device_os_type
in
res_dict
[
active_type
]:
day_id
=
yesterday_str
partition_date
=
yesterday_str
pid
=
hashlib
.
md5
((
day_id
+
device_os_type
+
active_type
)
.
encode
(
"utf8"
))
.
hexdigest
()
pid
=
hashlib
.
md5
((
partition_date
+
device_os_type
+
active_type
)
.
encode
(
"utf8"
))
.
hexdigest
()
click_num
=
res_dict
[
active_type
][
device_os_type
][
"click_num"
]
click_num
=
res_dict
[
active_type
][
device_os_type
][
"click_num"
]
exposure
=
res_dict
[
active_type
][
device_os_type
][
"exposure"
]
exposure
=
res_dict
[
active_type
][
device_os_type
][
"exposure"
]
try
:
try
:
...
@@ -222,8 +222,8 @@ and (dev.device_id is null or dev.device_id='')
...
@@ -222,8 +222,8 @@ and (dev.device_id is null or dev.device_id='')
except
:
except
:
search_ctr
=
0
search_ctr
=
0
instert_sql
=
"""replace into search_meigou_ctr(
instert_sql
=
"""replace into search_meigou_ctr(
day_id
,device_os_type,active_type,pid,click_num,exposure,search_ctr) VALUES('{day_id}','{device_os_type}','{active_type}','{pid}',{click_num},{exposure},{search_ctr});"""
.
format
(
partition_date
,device_os_type,active_type,pid,click_num,exposure,search_ctr) VALUES('{day_id}','{device_os_type}','{active_type}','{pid}',{click_num},{exposure},{search_ctr});"""
.
format
(
day_id
=
day_id
,
device_os_type
=
device_os_type
,
active_type
=
active_type
,
pid
=
pid
,
click_num
=
click_num
,
partition_date
=
partition_date
,
device_os_type
=
device_os_type
,
active_type
=
active_type
,
pid
=
pid
,
click_num
=
click_num
,
exposure
=
exposure
,
search_ctr
=
search_ctr
exposure
=
exposure
,
search_ctr
=
search_ctr
)
)
print
(
instert_sql
)
print
(
instert_sql
)
...
...
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