Commit b9f16035 authored by 张彦钊's avatar 张彦钊

change

parent 09f742b6
......@@ -75,12 +75,19 @@ def get_order():
r += 10000
print("insert done")
def to_csv():
def meigou_to_csv():
sql = "select device_id,service_id,created_time from meigou_order"
df = pd.DataFrame(list(get_mysql_data(host, port, user, passwd, db, sql)))
df = df.rename(columns={0: "user_id", 1: "service_id", 2: "created_time"})
df.to_csv('/tmp/csv/meigou_order.csv', index=False)
def user_device_to_csv():
sql = "select device_id,user_id from device_user"
df = pd.DataFrame(list(get_mysql_data(host, port, user, passwd, db, sql)))
df = df.rename(columns={0: "device_id", 1: "user_id"})
df.to_csv('/tmp/csv/device_user.csv', index=False)
if __name__ == "__main__":
# host = "172.16.30.141"
......@@ -95,7 +102,8 @@ if __name__ == "__main__":
user = "root"
passwd = "3SYz54LS9#^9sBvC"
db = "jerry_test"
to_csv()
user_device_to_csv()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment