My requirement is to import a csv document to database. The csv file has header field names with underscore (Eg. "first_name", "last_name"), but the database table column names don't have underscore in it. Thats why the data is not getting written to database successfully. Is there a way out here?
Discussion posts and replies are publicly visible
If you are using Import CSV to database plugin component, your csv field names and database table column names must be same. In case they are not same, you can use the plugin CSV to CDT Parser to first parse your CSV into a CDT and then use that CDT to write data to the database. If your CDT field names and table column names are different, you can map them in your CDT's xsd in the following way: <xsd:element name="first_name" nillable="true" type="xsd:string"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(length=255, name="first_name")</xsd:appinfo> </xsd:annotation> </xsd:element> The highlighted part indicates the table column name and your column name can be different from your <xsd:element name> which is your CDT field name.
Download latest version of Excel Tools -Plugin and use the smart service import csv to database with no headers option ticked. Use all the column headers as per the database and make sure the number of columns in CSV and database are same.Sequence does not matter.