ValidateCsv

Description:

Validates the contents of FlowFiles against a user-specified CSV schema. Take a look at the additional documentation of this processor for some schema examples.

Additional Details...

Tags:

csv, schema, validation

Properties:

In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.

Display NameAPI NameDefault ValueAllowable ValuesDescription
Schemavalidate-csv-schemaThe schema to be used for validation. Is expected a comma-delimited string representing the cell processors to apply. The following cell processors are allowed in the schema definition: [ParseBigDecimal, ParseBool, ParseChar, ParseDate, ParseDouble, ParseInt, ParseLong, Optional, DMinMax, Equals, ForbidSubStr, LMinMax, NotNull, Null, RequireHashCode, RequireSubStr, Strlen, StrMinMax, StrNotNullOrEmpty, StrRegEx, Unique, UniqueHashCode, IsIncludedIn]. Note: cell processors cannot be nested except with Optional.
Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)
Headervalidate-csv-headertrue
  • true
  • false
True if the incoming flow file contains a header to ignore, false otherwise.
Delimiter charactervalidate-csv-delimiter,Character used as 'delimiter' in the incoming data. Example: ,
Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)
Quote charactervalidate-csv-quote"Character used as 'quote' in the incoming data. Example: "
Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)
End of line symbolsvalidate-csv-eol\nSymbols used as 'end of line' in the incoming data. Example: \n
Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)
Validation strategyvalidate-csv-strategyFlowFile validation
  • Line by line validation In case an error is found, the input CSV file will be split into two FlowFiles: one routed to the 'valid' relationship containing all the correct lines and one routed to the 'invalid' relationship containing all the incorrect lines. Take care if choosing this option while using Unique cell processors in schema definition:the first occurrence will be considered valid and the next ones as invalid.
  • FlowFile validation As soon as an error is found in the CSV file, the validation will stop and the whole flow file will be routed to the 'invalid' relationship. This option offers best performances.
Strategy to apply when routing input files to output relationships.
Include all violationsvalidate-csv-violationsfalse
  • true
  • false
If true, the validation.error.message attribute would include the list of all the violations for the first invalid line. Note that setting this property to true would slightly decrease the performances as all columns would be validated. If false, a line is invalid as soon as a column is found violating the specified constraint and only this violation for the first invalid line will be included in the validation.error.message attribute.

Relationships:

NameDescription
validFlowFiles that are successfully validated against the schema are routed to this relationship
invalidFlowFiles that are not valid according to the specified schema are routed to this relationship

Reads Attributes:

None specified.

Writes Attributes:

NameDescription
count.valid.linesIf line by line validation, number of valid lines extracted from the source data
count.invalid.linesIf line by line validation, number of invalid lines extracted from the source data
count.total.linesIf line by line validation, total number of lines in the source data
validation.error.messageFor flow files routed to invalid, message of the first validation error

State management:

This component does not store state.

Restricted:

This component is not restricted.

Input requirement:

This component requires an incoming relationship.

System Resource Considerations:

None specified.