Issue with Import CSV to Database V5 Smart service

Certified Senior Developer

We are using Oracle database and below is the issue:

I have a requirement to load the CSV file data into database. For this, I have created one CDT and it’s primary key is configured as auto generated. 

And I am using the “Import CSV to Database V5” smart service to load the data. 

Here I am facing an issue and data is not getting inserted into database. This smart service is showing the below error message.

“ORA-01400: Cannot insert NULL into (“APPIANBD”.”testTable”.”id”)”

Where “testTable” is the table name and “id” is the primary key. 

The other tables, for which I am loading the data using “Write to Datastore entity” smart service , they are working fine. Data is getting inserted and also id is generated automatically. 

Only for these tables, in which I am loading the data using this smart interface, I am facing this issue.

Also, If I manually update the CSV file with some id values, then the data is storing in database. Otherwise, it is not auto generating the id values and throwing the above mentioned error.

  Discussion posts and replies are publicly visible

Parents
  • Hi

    In Write to Datastore entity the cdt has the @generated annotation, that's why the id generates automatically.

    In this case, you are inserting the data directly. I would suggest to create a sequence(eg: test_sq) against that table and use test_sq.nextval in the csv file against the ID column and then load the csv

  • 0
    Certified Senior Developer
    in reply to ankitab0001

    Hi Ankita,

    I actually don't have this balance id column in my source (csv) file. I have that in my CDT and database table as primary key and it was configured as auto generated. Also there is a sequence created in Oracle DB.

    As the system was throwing the mentioned error and data was not storing in DB, I tried adding that balance id in the source file itself and added values manually. Then the smart service worked and the data was stored.

    But in actual scenario, we shouldn't edit the source file and doesn't contain this balance_id column and it should be auto generated just like the way it works when we store the data using Write to data store entity smart service.

Reply
  • 0
    Certified Senior Developer
    in reply to ankitab0001

    Hi Ankita,

    I actually don't have this balance id column in my source (csv) file. I have that in my CDT and database table as primary key and it was configured as auto generated. Also there is a sequence created in Oracle DB.

    As the system was throwing the mentioned error and data was not storing in DB, I tried adding that balance id in the source file itself and added values manually. Then the smart service worked and the data was stored.

    But in actual scenario, we shouldn't edit the source file and doesn't contain this balance_id column and it should be auto generated just like the way it works when we store the data using Write to data store entity smart service.

Children