- last edited on
I have an usecase to dump the data from csv to cassandra.
My source CSV data has one date column which is in the format "d-MMM-yy".
eg (Sample input date):
I tried changing the date format to "yyyy-MM-dd" using CSVReader (Record Reader) and CSVWriter (Record Writer) inside updateattribute processor (along with other column data manipulation activity)
CSV Reader properties:
Avro Schema defined inside CSVReader:
CSV Writer properties:
Avro Schema defined inside CSVWriter:
Output of CSVWriter:
At the final step I have PutCassandraRecord processor, where I defined CSVReader (as Record Reader) with schemaText property as below.
But while executing flow, this putcassandrarecord routes to Failure state due to below error.
Cassandra table structure:
CREATE TABLE date_dump.forecast (destination_name text,date date,destination int,maximum int,minimum int,PRIMARY KEY (destination_name, date))
Could anyone help here to fix this issue, to dump the date column into cassandra table.
At a glance, the SQL command requires a different input than you give it.
Either a numeric representation (e.g. Unixtimestamp) or a specific string format. Based on the error the first one would be my guess.
Here is an example of the ToDate function that might help: https://community.cloudera.com/t5/Support-Questions/How-to-convert-string-to-date-in-NiFi/td-p/19134...
The key thing to keep in mind: Just because you have text that looks like a date to human eyes, does not mean this will be understood.