0

I'm struggling trying to insert a dataframe into a pl/sql table. I can query tables from my own schema w/out issues so the connection is fine. The dataframe shows up fine, but the last line throws me:

DatabaseError: Execution failed on sql 'SELECT name FROM sqlite_master WHERE type='table' AND name=?;': ORA-01036: illegal variable name/number

     import os 
     import datetime as dt
     import cx_Oracle
     import sqlalchemy
 
     username = '****'
     password = '****'

     dsn = '(DESCRIPTION=(CONNECT_TIMEOUT=15)(TRANSPORT_CONNECT_TIMEOUT=3)(RETRY_COUNT=3)\
       (ADDRESS=(PROTOCOL=TCP)(HOST=***)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)\
       (SERVICE_NAME=***)))'
     enc = 'utf-8'

connection = cx_Oracle.connect(user=username, password=password, dsn=dsn, encoding=enc)
cursor = connection.cursor()

sessions = glob.glob('path to daily file/*file with timestamp @ end of name*.csv')
latest_sessions = max(sessions, key=os.path.getctime, default = 0)

dfSessions = pd.read_csv(latest_sessions, sep=',', index_col=False, dtype='unicode')
dfSessions.drop([drop several columns], axis=1, inplace=True)

dfSessions.head(5)

dfSessions.to_sql('ARRAY_SESSIONS_NEW', connection,schema='BXP6281', if_exists='replace')
1

1 Answer 1

0

You are trying to use bind variables in a places where they are not allowed. Hence the error.

reference: oracle - ORA-01036: illegal variable name/number when running query through C# - Stack Overflow

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

Comments

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.