@[Pandas关闭Sqlalchemy数据库连接]
Pandas关闭Sqlalchemy数据库连接
若要真正关闭链接,则需要采用:conn.dispose()
conn = create_engine('mysql+pymysql:user:passwd@host:port/db?charset=etf-8')
try:
dataIn2File.to_sql(table_name,con=conn,if_exists='append',index=False)
except Exception as ee:
logger.error('fileToMysql fialed',ee)
traceback.print_exc()
finally:
conn.dispose()