Does the Pandas DataFrame.to_sql() function require a subsequent commit()?

核能气质少年 提交于 2019-12-05 14:58:04

Yes, at the end of the day it will be commited automatically.

Pandas calls SQLAlchemy method executemany (for SQL Alchemy connections):

conn.executemany(self.insert_statement(), data_list)

for SQLite connection:

def run_transaction(self):
    cur = self.con.cursor()
    try:
        yield cur
        self.con.commit()
    except:
        self.con.rollback()
        raise
    finally:
        cur.close()

And due to the SQL Alchemy docs executemany issues commit at the end

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!