import os
import pandas as pd
from sqlalchemy import create_engine

engine = create_engine('mysql+pymysql://rtech:S5RE4dQ65MphYk7F@47.95.217.180:3306/fmp')

sql = '''
SELECT 
  used_mobile, flow_amount
FROM 
   flow_order_info
WHERE 
  channel_id = 104 AND
  apply_date BETWEEN '2020-08-14 00:00:00'  AND '2020-08-14 23:59:59' AND
  status = 6; 
'''

df = pd.read_sql_query(sql, engine)
print(df)

df.to_csv("YaShan.csv", index=False, header=0 , sep=',')