conn = create_engine('mysql+pymysql:user:passwd@host:port/testdb?charset=utf-8')
df = pd.read_sql(query_sql, conn)
df.to_sql(tb_name, conn, if_exists='append', index=False)
con.dispose() # 真正关闭掉连接,使用 dispose() 函数
转载--Python如何正确地关闭sqlalchemy的连接池
最新推荐文章于 2024-07-26 10:09:01 发布