0

I am using Oracle, and I am seeing the table created in the schema (albeit all with CLOB columns for VARCHARs). But no data is being inserted? The dataframe does have data in it.

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)

I read a commit() is not needed here Does the Pandas DataFrame.to_sql() function require a subsequent commit()?

smackenzie
  • 2,880
  • 7
  • 46
  • 99
  • Well I got it working without con.commit(). I had to replace clobs and set autocommit on the connection. None of which was described in any examples. I am not sure which one solved the problem to be honest. – smackenzie Dec 04 '21 at 12:18
  • 1
    Apparently commit is not needed https://stackoverflow.com/questions/47741775/does-the-pandas-dataframe-to-sql-function-require-a-subsequent-commit – smackenzie Dec 04 '21 at 12:21

1 Answers1

0

I encountered similar problem and switching to sqlalchemy instead of cx_Oracle as the engine helped in my scenario.