Member since
11-13-2018
9
Posts
0
Kudos Received
0
Solutions
11-27-2018
04:03 PM
As first step I looked up the DB and with ExecuteSQL and converted the Avro-File I got to a Json-File using the ConvertAvroToJson processor. Now I am having two Json-Files that have a lot of same and a lot of different keys. The self-generated Json - as presented above - is nested and the Json-File from the DB is flat, as I am extracting the relevant DB-Information step-by-step. I'd like to use ExecuteScript with JavaScript now, as I would like to merge both Jsons in that way that every matching key gets the value of the self-generated Json and every missing key(the DB-Json has a lot more keys) is added to the self-generated Json. My problem is now especially that I do not know how to read two seperate Jsonfiles with Javascript/Executescript without overwrite them. Furthermore I do not know how to seperate the incoming Flowfiles (detect if they are coming from one or another processor). It would be nice if you could give me any suggestions. @Prabhu M
... View more
11-28-2018
08:12 AM
Hey @Matt Burgess , thanks for your reply. I got this issue solved. My new problem is explained in a new topic. I get for every Table a new Json that I have to match with the self-generated Json and put it in the DB with mutliple tables. And I do not know how to achieve this in a proper way.
... View more
11-14-2018
03:46 PM
1 Kudo
Another possibility is FlattenJson, but your destination table would have to have the same naming convention (based on your choice of the Separator property in FlattenJson) in order for the INSERT to be successful. JoltTransformJSON won't automatically flatten things, you'd need to know your schema in order to write the spec, but then you'd have more control over what the output field names would be. ExecuteScript could be a last resort; Groovy has very good JSON-handling capabilities.
... View more