Created 07-19-2023 01:17 AM
Hello everyone,
I am new to Apache Nifi and would like to create a basic flow that takes a very simple CSV file (2 columns, 2 rows) as input and loads it into a MySQL database.
Here is the CSV file :
I have already created the "DBCPConnectionPool" service controller, which has been validated.
I use a GetFile processor to retrieve the file and a PutDatabaseRecord processor to try to write it to the database.
The PutDatabaseRecord processor is configured to use the CSVReader.
Here is the CSVreader controller service :
I have also created the target table :
That's the (very basic) flow :
However, I am encountering this error:
Could you please indicate what might be causing the problem?
Thank you very much in advance.
Julien
Created 07-19-2023 06:05 AM
I just understood why it wasn't working: the field separator was set to ",", while my file uses ";" as the field separator.
After modifying it, everything works perfectly!
I have another question: would it be possible to load data in CSV format into a MySQL database without having to create the structure of the different fields beforehand?
Because when there are only a few fields, it's simple. But if the CSV file has several dozens of fields, it can quickly become tedious and cumbersome to create all the fields.
So, I'm wondering how to proceed to automatically create the schema within the target table.
Thank you very much in advance for your help.
Julien
Created 07-19-2023 10:09 PM
@juliendata92, Welcome to our community! To help you get the best possible answer, I have tagged our NiFi experts @cotopaul @SAMSAL @MattWho @hegdemahendra who may be able to assist you further.
Please feel free to provide any additional information or details about your query, and we hope that you will find a satisfactory solution to your question.
Regards,
Vidya Sargur,