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()?

2
  • 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. Commented Dec 4, 2021 at 12:18
  • 1
    Apparently commit is not needed stackoverflow.com/questions/47741775/… Commented Dec 4, 2021 at 12:21

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

3 Comments

I am using sqlalchemy create_engine, just with the oracle driver?
SQLAlchemy uses cx_Oracle!
So what would my driver string look like?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.