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
bdd38356
Commit
bdd38356
authored
Nov 18, 2020
by
litaolemo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
2798c64b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
daily_search_word_count.py
task/daily_search_word_count.py
+4
-6
No files found.
task/daily_search_word_count.py
View file @
bdd38356
...
...
@@ -78,7 +78,7 @@ for t in range(0, task_days):
SELECT query,
partition_date,
all_search_uv as all_search_uv, --全部搜索uv
t3.
all_search_pv as all_search_pv --全部搜索pv
all_search_pv as all_search_pv --全部搜索pv
FROM (
--搜索pvuv
SELECT query
...
...
@@ -181,14 +181,12 @@ for t in range(0, task_days):
GROUP BY query,partition_date
) t3 order by all_search_uv desc
"""
.
format
(
start_date
=
today_str
,
end_date
=
yester
day_str
)
"""
.
format
(
start_date
=
yesterday_str
,
end_date
=
to
day_str
)
print
(
sql_search_ctr
)
search_ctr_df
=
spark
.
sql
(
sql_search_ctr
)
# spam_pv_df.createOrReplaceTempView("dev_view")
search_ctr_df
.
show
(
1
)
sql_res
=
search_ctr_df
.
collect
()
# date_str = yesterday_date.strftime("%Y%m%d")
tag_names_list_week
=
[]
for
name
in
sql_res
:
word
=
name
.
get
(
"query"
)
...
...
@@ -208,9 +206,9 @@ for t in range(0, task_days):
pid
=
hashlib
.
md5
((
partition_date
+
word
)
.
encode
(
"utf8"
))
.
hexdigest
()
insert_sql_tuple
=
(
word
,
nums
,
uv
,
pid
,
date_str
)
insert_list
.
append
(
insert_sql_tuple
)
#
print(insert_sql)
print
(
insert_sql
)
if
count
%
100
==
0
:
#
cursor.execute("set names 'UTF8'")
cursor
.
execute
(
"set names 'UTF8'"
)
res
=
cursor
.
executemany
(
insert_sql
,
insert_list
)
db
.
commit
()
# print(res)
...
...
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