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
1552b35d
Commit
1552b35d
authored
Jul 12, 2021
by
郭羽
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test:export service ecpm data
parent
1f12a545
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
25 deletions
+0
-25
ecpm_data_export_test.py
test/ecpm_data_export_test.py
+0
-25
No files found.
test/ecpm_data_export_test.py
deleted
100644 → 0
View file @
1f12a545
import
pymysql
import
pandas
as
pd
def
getConn
():
# 从数据库的表里获取数据
db
=
pymysql
.
connect
(
host
=
'172.16.50.175'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm'
,
db
=
'doris_olap'
)
# cursor = db.cursor()
# cursor.execute(sql)
return
db
if
__name__
==
'__main__'
:
sql
=
"""
select day_id,service_id,service_all_first_browse_num_d,service_all_preciseexpose_num_d,service_cpc_expend_recharge_amount_d
,service_add_cart_click_num_d,service_message_click_num_d,service_buy_click_num_d,service_validate_order_commission_non_doctor_d
from sl_strategy_pt_sv_servicesmartrank_d where day_id='20210711'
"""
conn
=
getConn
()
df
=
pd
.
read_sql_query
(
sql
,
conn
)
print
(
df
.
head
(
10
))
print
(
df
.
count
())
df
.
to_excel
(
"ecpm_data.xlsx"
)
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