Search code examples
pythonoracle-databasecx-oracle

cx_Oracle.NotSupportedError: Python value of type tuple not supported


I am trying to insert data into an Oracle database, while in the process I am getting this error cx_Oracle.NotSupportedError: Python value of type tuple not supported.

Script I am using

curs.execute('insert into APP(APP_CODE,APP_NAME,PARENT_APP_CODE,INSERT_DTTM,INSERT_USER,UPDATE_DTTM,UPDATE_USER,IDFED_PROVIDER_ID,IDFED_SAML_GTWY_URL,TEMPLATE_FTL,USER_ACCTS_FLAG,XML_DATA_FLAG,CAPS_REQUIRED,SESSIONID_REQUIRED) VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14)'',row_data)

DB Schema

(APP_CODE VARCHAR2(50 BYTE) NOT NULL 
, APP_NAME VARCHAR2(80 BYTE) NOT NULL 
, PARENT_APP_CODE VARCHAR2(20 BYTE) 
, INSERT_DTTM TIMESTAMP(6) DEFAULT SYSDATE NOT NULL 
, INSERT_USER VARCHAR2(150 BYTE) DEFAULT USER NOT NULL 
, UPDATE_DTTM TIMESTAMP(6) DEFAULT SYSDATE NOT NULL 
, UPDATE_USER VARCHAR2(150 BYTE) DEFAULT USER NOT NULL 
, IDFED_PROVIDER_ID VARCHAR2(1000 BYTE) 
, IDFED_SAML_GTWY_URL VARCHAR2(2000 BYTE) 
, TEMPLATE_FTL CLOB 
, USER_ACCTS_FLAG VARCHAR2(30 BYTE) 
, XML_DATA_FLAG VARCHAR2(30 BYTE) 
, CAPS_REQUIRED VARCHAR2(1 BYTE) DEFAULT 'N' 
, SESSIONID_REQUIRED VARCHAR2(1 BYTE) DEFAULT 'N')

can anyone please help me?


Solution

  • I am using currently:

    row_data = [("appcode","appName","parent_app_code",datetime.datetime.now(),"insert",datetime.datetime.now(),"update_user","idfed_provider_id","idfed_SAML_gateway_URL","template","false","true","N","Y")]
    

    row_data is a list containing a tuple of 14 items. curs.execute is assigning the first element of the list to :1; however, that first element is the tuple which causes the error to be thrown.

    As mentioned by @Matthias you should remove either the [] list or the () tuple:

    row_data = ("appcode","appName","parent_app_code",datetime.datetime.now(),"insert",datetime.datetime.now(),"update_user","idfed_provider_id","idfed_SAML_gateway_URL","template","false","true","N","Y")
    

    or

    row_data = ["appcode","appName","parent_app_code",datetime.datetime.now(),"insert",datetime.datetime.now(),"update_user","idfed_provider_id","idfed_SAML_gateway_URL","template","false","true","N","Y"]