Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

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
Expert 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
Expert 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