Support Questions

Find answers, ask questions, and share your expertise

in nifi using putdatabaserecord when i am inserting data to the db then why is 0 being omitted like if it is 0123 then in db only 123 is getting

avatar
Contributor

In nifi I am using PutDatabaseRecord. When i am inserting data to the db then why is 0 being omitted like if it is 0123 then in db only 123 is inserting in the table. Note: If I use PutSql then it is not omitting leading 0. How to configure PutDatabaseRecord to not omit leading zeros.

2 REPLIES 2

avatar
Super Guru

Hi,

Can you provide screen shot of how each processor is being configured? Also for the PutDatabaseRecord what format are you using for the Reader services and are you providing defined schema or are you using default infer schema? what I suspect is happening is that if you are using Infer schema in the record reader its converting the value into integer therefore the leading zero will be omitted. In this case you need to provide the avro schema where the field holding this value is assign a string data type.

If that helps please accept the solution.

Thanks

avatar
Contributor

hello, one stackoverflow answer suggested to configure property "Record Reader"-> "Csv Reader".  Property of Controller Service (Csv Reader), "Schema Access Strategy" to be "Use String Fields from header". This helped. 
You are telling about Avro Schema. Could you please give some insights. How to configure that?

Also I have one more different topic question. Say I have a file having 100 records. In this file I want to ignore the first line as it's data I do not want to process. I want to process from second line. How to do that?
Thanks