Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
ffm-baseline
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ML
ffm-baseline
Commits
eed064fe
Commit
eed064fe
authored
Oct 17, 2018
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改sql
parent
524fde45
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
ctr-56.py
ctr-56.py
+9
-8
No files found.
ctr-56.py
View file @
eed064fe
...
...
@@ -3,7 +3,6 @@ import pymysql
import
datetime
import
pandas
as
pd
DIRECTORY_PATH
=
"/data/ffm/"
def
get_yesterday_date
():
today
=
datetime
.
date
.
today
()
...
...
@@ -19,22 +18,22 @@ def get_data():
sql
=
"select device_id from ffm_diary_queue where device_id regexp '[5|6]$'"
cursor
.
execute
(
sql
)
result
=
cursor
.
fetchall
()
device
_id
=
tuple
(
pd
.
DataFrame
(
list
(
result
))[
0
]
.
values
.
tolist
())
device
=
tuple
(
pd
.
DataFrame
(
list
(
result
))[
0
]
.
values
.
tolist
())
cursor
.
close
()
print
(
device
_id
[
0
:
2
])
print
(
device
[
0
:
2
])
return
device
_id
return
device
def
ctr_all
():
db
=
pymysql
.
connect
(
host
=
'10.66.157.22'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_prod'
)
cursor
=
db
.
cursor
()
sql_active
=
"select distinct device_id from data_feed_exposure
where (cid_type = 'diary' or cid_type = 'diary_video')
"
\
"and device_id regexp'[5|6]$' and stat_date = '{}';"
.
format
(
date
)
sql_active
=
"select distinct device_id from data_feed_exposure "
\
"
where cid_type = 'diary'
and device_id regexp'[5|6]$' and stat_date = '{}';"
.
format
(
date
)
cursor
.
execute
(
sql_active
)
result
=
cursor
.
fetchall
()
tail56
=
tuple
(
pd
.
DataFrame
(
list
(
result
))[
0
]
.
values
.
tolist
()
)
start
=
"201
2
-09-05"
tail56
=
pd
.
DataFrame
(
list
(
result
))[
0
]
.
values
.
tolist
(
)
start
=
"201
8
-09-05"
sql_all
=
"select distinct device_id from data_feed_click "
\
"where stat_date >= '{}' and stat_date <= '{}' and cid_type = 'diary'"
.
format
(
start
,
date
)
cursor
.
execute
(
sql_all
)
...
...
@@ -96,7 +95,9 @@ def rate2file():
+
","
+
str
(
data
[
5
])
+
'
\n
'
f
.
write
(
line
)
if
__name__
==
"__main__"
:
DIRECTORY_PATH
=
"/data/ffm/"
date
=
get_yesterday_date
()
device_id
=
get_data
()
temp_data
=
ctr
()
...
...
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