I try to write pandas dataframe to Oracle and with to_sql method, sometimes writes successfully and sometimes gives "(cx_Oracle.DatabaseError) ORA-03106: fatal two-task communication protocol error" with same dataframe.
I checked most of the oracle errors for ORA-03106 but could not understand why it is working sometimes and not working for another try.
from sqlalchemy import create_engine
oracle_connection_string = 'oracle+cx_oracle://{username}:{password}@{hostname}:
{port}/{database}'
engine = create_engine(
oracle_connection_string.format(
username= 'user',
password= 'pass',
hostname='.....',
port='..',
database='sampledb',
)
)
dataset.to_sql('TEST_TABLE',engine,if_exists='append',index =False)