Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Json data to hive Database

avatar
New Contributor

Hi, I'm new to Apache NiFi and really struggle to apply online previous answers for my question, the Idea is to fetch json from Apache Kafka using a ConsumeKafka processor, it fetches data correctly, now I want to take the attributes from the consumer and load them to a hive database. I tried EvaluationJsonPath to parse the json and log attributes separated, upon inspecting the queue the json appears as from the source and not attributes separated.

ehehtenandayo_1-1710172160251.png

Notice how I don't include 'Price/Meter' attribute to test:

ehehtenandayo_0-1710172129989.png

This is the queue after the EvaluateJsonPath processor (similar to the source):

ehehtenandayo_2-1710172230400.png

 


Any help dealing with the json to hive situation would be appreciated, thanks.

2 REPLIES 2

avatar

@ehehtenandayo You should be looking at nifi's record based processors.  

NiFi includes the following RecordReader and RecordWriter Processors:

  • ConsumeKafkaRecord_0_10 1.2.0
  • ConvertRecord
  • PublishKafkaRecord_0_10
  • PutDatabaseRecord
  • QueryRecord
  • SplitRecord

 

These processor use record reader and record writer, which can define or infer the schema of the json.   Then, you are able to write a SQL statement for the results you want.   Additionally this will help with taking those flowfiles of json and feeding them to a putHive processor.

Here is an older post that will help with some of the fundamentals:

https://community.cloudera.com/t5/Community-Articles/Using-HiveQL-Processors-in-Apache-NiFi-1-2/ta-p...

 

 

 

 

avatar
Community Manager

@ehehtenandayo Has the reply helped resolve your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future. Thanks.


Regards,

Diana Torres,
Community Moderator


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community: