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')