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
71ef6cfc
Commit
71ef6cfc
authored
Sep 17, 2020
by
litaolemo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
4ad33c30
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
28 deletions
+25
-28
new_user_has_protratit_rate.py
new_user_analysis/new_user_has_protratit_rate.py
+25
-28
No files found.
new_user_analysis/new_user_has_protratit_rate.py
View file @
71ef6cfc
...
@@ -189,9 +189,10 @@ WHERE spam_pv.device_id IS NULL
...
@@ -189,9 +189,10 @@ WHERE spam_pv.device_id IS NULL
"projects"
:
{},
"projects"
:
{},
'anecdote_tags'
:{}
'anecdote_tags'
:{}
}
}
no_portrait_device_id_list
=
[]
print
(
"-------------------------------"
)
print
(
"-------------------------------"
)
count_not_has_portratit
=
0
count_not_has_portratit
=
0
for
count_user_count
,
res
in
enumerate
(
sql_res
):
for
count_user_count
,
res
in
enumerate
(
sql_res
):
# print(count, res)
# print(count, res)
portratit_res
=
get_user_portrait_tag3_from_redis
(
res
.
device_id
)
portratit_res
=
get_user_portrait_tag3_from_redis
(
res
.
device_id
)
...
@@ -212,34 +213,30 @@ WHERE spam_pv.device_id IS NULL
...
@@ -212,34 +213,30 @@ WHERE spam_pv.device_id IS NULL
temp_count
+=
1
temp_count
+=
1
if
not
temp_count
:
if
not
temp_count
:
count_not_has_portratit
+=
1
count_not_has_portratit
+=
1
no_portrait_device_id_list
.
append
(
res
.
device_id
)
print
(
portrait_dict
)
print
(
portrait_dict
)
print
(
count_user_count
+
1
,
count_not_has_portratit
)
print
(
count_user_count
+
1
,
count_not_has_portratit
)
print
(
"-------------------------------"
)
print
(
"-------------------------------"
)
portrait_dict
[
"second_demands"
][
"no_portratit"
]
=
count_not_has_portratit
# for action in res_dict:
for
protratit_type
in
portrait_dict
[
"second_demands"
]:
# partition_date = yesterday_str
partition_date
=
today_str
# pid = hashlib.md5((partition_date + action).encode("utf8")).hexdigest()
pid
=
hashlib
.
md5
((
partition_date
+
protratit_type
)
.
encode
(
"utf8"
))
.
hexdigest
()
# action_count = res_dict[action]
action_count
=
res_dict
[
protratit_type
]
# action_ch = name_dict.get(action)
# if not action_ch:
instert_sql
=
"""replace into new_user_protratit_count(
# action_ch = action
partition_day,pid,protratit_count,protratit_type) VALUES('{partition_day}','{pid}',{protratit_count},'{protratit_type}');"""
.
format
(
# if action_ch in exception_list:
partition_day
=
today_str
,
pid
=
pid
,
protratit_count
=
portrait_dict
[
"second_demands"
][
protratit_type
]
# continue
,
protratit_type
=
protratit_type
# instert_sql = """replace into new_user_click_count(
)
# partition_day,pid,action_count,action_ch,action) VALUES('{partition_day}','{pid}',{action_count},'{action_ch}','{action}');""".format(
print
(
instert_sql
)
# partition_date=partition_date, partition_day=yesterday_str, pid=pid, action_count=action_count,
# cursor.execute("set names 'UTF8'")
# action_ch=action_ch, action=action
db
=
pymysql
.
connect
(
host
=
'172.16.40.158'
,
port
=
4000
,
user
=
'st_user'
,
passwd
=
'aqpuBLYzEV7tML5RPsN1pntUzFy'
,
# )
db
=
'jerry_prod'
)
# print(instert_sql)
cursor
=
db
.
cursor
()
# # cursor.execute("set names 'UTF8'")
res
=
cursor
.
execute
(
instert_sql
)
# db = pymysql.connect(host='172.16.40.158', port=4000, user='st_user', passwd='aqpuBLYzEV7tML5RPsN1pntUzFy',
db
.
commit
()
# db='jerry_prod')
print
(
res
)
# cursor = db.cursor()
# cursor.executemany()
# res = cursor.execute(instert_sql)
db
.
close
()
# db.commit()
# print(res)
# # cursor.executemany()
# db.close()
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