Re: saving record into different tables?
Ok, I've got "split" working but that still leaves me with the dilemma: i have to write multiple rows for "mylist" into the same table... Note that I am working with db (Phoenix Query Server) that doesn't support "batching" of multiple records in one insert as mysql. Any advise? On Wed, Sep 5, 2018 at 10:04 PM Matt Burgess wrote: > V, > > Perhaps ironically but for the greater good, NiFi (IMHO, with record > processors) performs better when you don't touch the content but just > describe what you want from it. So in your case you could send the > content to two different branches, one could be a PutDatabaseRecord > with a reader schema that ignores the "mylist" element, and the other > could use Jolt / SplitRecord / ForkRecord to "hoist" the fields from > the "mylist" element into a root array/RecordSet, then use > PutDatabaseRecord to process it. Then you don't need a "split" or "get > into attribute" or any other operation that isn't in line with your > business logic. > > Regards, > Matt > > On Fri, Aug 31, 2018 at 7:34 PM l vic wrote: > > > > Hi, > > I have a json record that contains array "mylst": > > { > > "id": 0, > > "name": "Root", > > "mylist": [{ > > "id": 10, > > "info": "2am-3am" > > }, > > { > > "id": 11, > > "info": "3AM-4AM" > > }, > > { > > "id": 12, > > "info": "4am-5am" > > }] > > > > } > > I have to save root data into one db table and array into another... Can > someone recommend an approach to "splitting" of record for 2 different > database writers? > > Thank you, > > V >
Re: saving record into different tables?
Would it be possible to have some example of such transform? On Mon, Sep 3, 2018 at 4:18 AM DEHAY Aurelien wrote: > Hello. > > > > I would flatten the records with jolt, with a kind of flag to know if it’s > “root” data or not. Then I would extract the flag in an attribute with > evaluatejson path, and at the end route with RouteOnAttribute. > > > > *Aurélien* > > > > *From:* l vic [mailto:lvic4...@gmail.com] > *Sent:* samedi 1 septembre 2018 01:34 > *To:* users@nifi.apache.org > *Subject:* saving record into different tables? > > > > Hi, > > I have a json record that contains array "mylst": > > { > > "id": 0, > > "name": "Root", > > "mylist": [{ > > "id": 10, > > "info": "2am-3am" > > }, > > { > > "id": 11, > > "info": "3AM-4AM" > > }, > > { > > "id": 12, > > "info": "4am-5am" > > }] > > > > } > > I have to save root data into one db table and array into another... Can > someone recommend an approach to "splitting" of record for 2 different > database writers? > > Thank you, > > V > > This electronic transmission (and any attachments thereto) is intended > solely for the use of the addressee(s). It may contain confidential or > legally privileged information. If you are not the intended recipient of > this message, you must delete it immediately and notify the sender. Any > unauthorized use or disclosure of this message is strictly prohibited. > Faurecia does not guarantee the integrity of this transmission and shall > therefore never be liable if the message is altered or falsified nor for > any virus, interception or damage to your system. >
RE: saving record into different tables?
Hello. I would flatten the records with jolt, with a kind of flag to know if it’s “root” data or not. Then I would extract the flag in an attribute with evaluatejson path, and at the end route with RouteOnAttribute. Aurélien From: l vic [mailto:lvic4...@gmail.com] Sent: samedi 1 septembre 2018 01:34 To: users@nifi.apache.org Subject: saving record into different tables? Hi, I have a json record that contains array "mylst": { "id": 0, "name": "Root", "mylist": [{ "id": 10, "info": "2am-3am" }, { "id": 11, "info": "3AM-4AM" }, { "id": 12, "info": "4am-5am" }] } I have to save root data into one db table and array into another... Can someone recommend an approach to "splitting" of record for 2 different database writers? Thank you, V This electronic transmission (and any attachments thereto) is intended solely for the use of the addressee(s). It may contain confidential or legally privileged information. If you are not the intended recipient of this message, you must delete it immediately and notify the sender. Any unauthorized use or disclosure of this message is strictly prohibited. Faurecia does not guarantee the integrity of this transmission and shall therefore never be liable if the message is altered or falsified nor for any virus, interception or damage to your system.
saving record into different tables?
Hi, I have a json record that contains array "mylst": { "id": 0, "name": "Root", "mylist": [{ "id": 10, "info": "2am-3am" }, { "id": 11, "info": "3AM-4AM" }, { "id": 12, "info": "4am-5am" }] } I have to save root data into one db table and array into another... Can someone recommend an approach to "splitting" of record for 2 different database writers? Thank you, V