Created 11-15-2017 09:56 PM
I'm trying to come up with a means for dynamic attribute creation. Say I've got a flat Json structured string of name value pairs, in a cassandra db as a text field.
{"A":"1", "B":"2"}
Is there a way to parse this out to a result of an A attribute with value 1 and B attribute with value 2 without explicitly creating a A attribute then polling the jsonpath?
I haven't had any luck in finding a way to dynamically set the lefthand side of an 'update attribute' and wondering if I'm just overlooking something.
Created 11-16-2017 02:58 PM
You could probably implement a custom processor like "JsonToAttributes" very easily, iterate through a JSON document and add each field/value as an attribute to the flow file, or do it with a Groovy script in ExecuteScript.
The reason it doesn't exist is that in the general case you should be careful about adding a significant amount of attributes because those are held in memory, so if we provided this processor people would start using it to adding 100s of attributes to their flow files which could lead to poor performance and memory issues.
Created 11-16-2017 02:58 PM
You could probably implement a custom processor like "JsonToAttributes" very easily, iterate through a JSON document and add each field/value as an attribute to the flow file, or do it with a Groovy script in ExecuteScript.
The reason it doesn't exist is that in the general case you should be careful about adding a significant amount of attributes because those are held in memory, so if we provided this processor people would start using it to adding 100s of attributes to their flow files which could lead to poor performance and memory issues.