CSVDataSource
The CSVDataSource
reads records from a CSV file. The column names must be either configured within the DataSource
configuration or they can be read from the CSV file's first line. The entries can be trimmed from whitespace if requested. Empty columns are set to null.
Configuration
Name | Type, usage constraints, defaults | Description |
---|---|---|
filename | required: paraVal default: none type: path to readable CSV file | Name of the CSV file which is used as the record source. |
attributes | optional: paraList default: none type: list of strings | Defines the column names of the CSV file. If defined, the CSV file must start with a data record. The column names may not be contained in the CSV file. If attributes is not defined, the CSV file must contain the column names in the first line of the CSV file. |
separator | optional: paraVal default: , type: char | Separator character used as delimiter for separating entries. |
quotechar | optional: paraVal default: " type: char | Quoting character used for quoted elements. |
trim | optional: paraVal default: false type: boolean | The entries are trimmed from whitespace if this parameter is set to true. |
encoding | optional: paraVal default: default encoding type: string | The name of the character set that should be used to to decode the file. The available values depend on the version and vendor of the JVM. Examples: UTF-8, ISO-8859-1, UTF-16LE |
Example
<dataSource type="CSVDataSource">
<dp:paraVal name="filename" value="etc/csv.in"/>
<dp:paraVal name="separator" value=";" type="char"/>
<dp:paraVal name="quotechar" value="\t" type="char"/>
<dp:paraList name="attributes">
<value>firstname</value>
<value>lastname</value>
<value>email</value>
</dp:paraList>
</dataSource>