【发布时间】:2022-01-09 23:28:14
【问题描述】:
我正在使用 Oracle,并且我看到了在架构中创建的表(尽管所有表都包含 VARCHAR 的 CLOB 列)。但是没有数据被插入?数据框中确实有数据。
engine = create_engine('oracle+cx_oracle://user:password@host:1521/?service_name=myservice', max_identifier_length=128)
df = get_registrations()
df.to_sql(name='pandas_registrations', con=engine, if_exists='replace', chunksize=1000, schema='ANALYTICS', method=None)
我读到这里不需要 commit() Does the Pandas DataFrame.to_sql() function require a subsequent commit()?
【问题讨论】:
-
好吧,我在没有 con.commit() 的情况下让它工作了。我不得不替换 clob 并在连接上设置自动提交。在任何示例中都没有描述这些内容。老实说,我不确定哪一个解决了这个问题。