Shrads
Shrads

Reputation: 883

Ingesting CSV data to MySQL DB in NiFi

I am trying to ingest the data of my CSV file into MySQL Db. My CSV file have field called 'MeasurementTime' value as 2018-06-27 11:14.50. My flow is taking that field as string and thus PutSQL is giving error. I am using the same template as per this Template but not using the InferAvro processor as i already have a pre-defined schema. This is the website Website link

How can I pass a Datetime field into my MySQL db as correct datatype and not as string. What setting should I change?

Thank you

Upvotes: 2

Views: 3055

Answers (1)

Sivaprasanna Sethuraman
Sivaprasanna Sethuraman

Reputation: 4132

With PutDatabaseRecord you can avoid all this chain of transformations and overengineering. The flow would be like:

GetFile -> PutDatabaseRecord

You need to configure PutDatabaseRecord with RecordReader property configured to CSVReader and configure CSVReader and set its Schema Registry to AvroSchemaRegistry and provide the valid schema. you can find the template for a sample flow here.

Upvotes: 2

Related Questions