pymysql和mysqldb 新版python都不在支持flavor
开始使用sqlalchemy封装,不露出数据库连接接口细节
以后调用格式如下:
from sqlalchemy import create_engine
engine=create_engine("mysql+mysqldb://root:112358js@localhost:3306/js_db",echo=True)
df = pd.read_csv('pf.txt', sep='|', header=None)
df.to_sql(name='your_db_table', con=engine, flavor = None, if_exists = 'append', index=False)