Commit c527ad24 authored by 王志伟's avatar 王志伟

将csv写入tidb

parent 0b165da8
...@@ -8,7 +8,7 @@ data=pd.read_excel('knowledge_network.xls') ...@@ -8,7 +8,7 @@ data=pd.read_excel('knowledge_network.xls')
print(data.head()) print(data.head())
# # 初始化数据库连接,使用pymysql模块 # # 初始化数据库连接,使用pymysql模块
engine = create_engine(str(r"mysql+mysqldb://%s:" + '%s' + "@%s:%s/%s") % (root,3SYz54LS9#^9sBvC,'10.66.157.22', 4000, jerry_prod)) engine = create_engine(str(r"mysql+mysqldb://%s:" + '%s' + "@%s:%s/%s") % ("root","3SYz54LS9#^9sBvC",'10.66.157.22', "4000", "jerry_prod"))
# engine = create_engine('mysql+pymysql://root:147369@localhost:3306/mydb') # engine = create_engine('mysql+pymysql://root:147369@localhost:3306/mydb')
data.to_sql('testtttttttttttt',con=engine,if_exists='append',index=False) data.to_sql('testtttttttttttt',con=engine,if_exists='append',index=False)
# # 读取本地CSV文件 # # 读取本地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