<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question NiFi: Creating a single JSON from multiple SQL tables in NiFi in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Creating-a-single-JSON-from-multiple-SQL-tables-in-NiFi/m-p/154844#M44763</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I have three tables in MySQL. Employee_Info, Address, Phone. The Employee table is the primary table with address and phone being related to this table via the foreign key relationship. &lt;/P&gt;&lt;P&gt;I want to create a single Json file which will contain the employee records with the address and phone as arrays in each record.&lt;/P&gt;&lt;P&gt;How do I do this? I can read the data using Execute SQl but how do I access the separate flow files at the same time to merge them into one. then after that how will i do the merging? I am not familiar with Jolt. Can transform jolt json processor be used somehow. or do i simple write a new custom processor?&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Arsalan&lt;/P&gt;</description>
    <pubDate>Fri, 28 Oct 2016 20:24:47 GMT</pubDate>
    <dc:creator>arsalan_siddiqi</dc:creator>
    <dc:date>2016-10-28T20:24:47Z</dc:date>
    <item>
      <title>NiFi: Creating a single JSON from multiple SQL tables in NiFi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Creating-a-single-JSON-from-multiple-SQL-tables-in-NiFi/m-p/154844#M44763</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I have three tables in MySQL. Employee_Info, Address, Phone. The Employee table is the primary table with address and phone being related to this table via the foreign key relationship. &lt;/P&gt;&lt;P&gt;I want to create a single Json file which will contain the employee records with the address and phone as arrays in each record.&lt;/P&gt;&lt;P&gt;How do I do this? I can read the data using Execute SQl but how do I access the separate flow files at the same time to merge them into one. then after that how will i do the merging? I am not familiar with Jolt. Can transform jolt json processor be used somehow. or do i simple write a new custom processor?&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Arsalan&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2016 20:24:47 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Creating-a-single-JSON-from-multiple-SQL-tables-in-NiFi/m-p/154844#M44763</guid>
      <dc:creator>arsalan_siddiqi</dc:creator>
      <dc:date>2016-10-28T20:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi: Creating a single JSON from multiple SQL tables in NiFi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Creating-a-single-JSON-from-multiple-SQL-tables-in-NiFi/m-p/154845#M44764</link>
      <description>&lt;P&gt;Do they need to be separate fetches? If you use a single ExecuteSQL with JOINs for the foreign keys, you can get a single result set (in Avro), then use &lt;A target="_blank" href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.avro.ConvertAvroToJSON/index.html"&gt;ConvertAvroToJSON&lt;/A&gt; to convert to a single JSON object.&lt;/P&gt;&lt;P&gt;If they must be in different flow files, there is currently no "MergeJSON" processor, although that would be a great contribution if you're interested in writing a full processor. An alternative is to use &lt;A target="_blank" href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.script.ExecuteScript/index.html"&gt;ExecuteScript&lt;/A&gt; or &lt;A target="_blank" href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.script.InvokeScriptedProcessor/index.html"&gt;InvokeScriptedProcessor&lt;/A&gt;. In either case, keep in mind that NiFi employs a flow-based paradigm, so merging arbitrary incoming flow files can be tricky. This is done in some splitting processors (such as &lt;A target="_blank" href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.standard.SplitText/index.html"&gt;SplitText&lt;/A&gt;) by setting "fragment.id", "fragment.count", and "fragment.index" attributes on the flow files, so a downstream "merging" processor can handle these micro-batches by merging together all files with the same fragment.id. I've got an example of this kind of merging processor as a pull request for &lt;A target="_blank" href="https://issues.apache.org/jira/browse/NIFI-2735"&gt;NIFI-2735&lt;/A&gt;. If you're using a scripting processor and just want to solve this one specific issue, you could assume that you will only get 3 incoming flow files and merge them accordingly. This is fragile but could work for your use case. &lt;/P&gt;</description>
      <pubDate>Sat, 29 Oct 2016 00:00:26 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Creating-a-single-JSON-from-multiple-SQL-tables-in-NiFi/m-p/154845#M44764</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2016-10-29T00:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi: Creating a single JSON from multiple SQL tables in NiFi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Creating-a-single-JSON-from-multiple-SQL-tables-in-NiFi/m-p/154846#M44765</link>
      <description>&lt;P&gt;Could something be down with   &lt;STRONG&gt;JoltTransformJSON&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.standard.JoltTransformJSON/index.html" target="_blank"&gt;https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.standard.JoltTransformJSON/index.html&lt;/A&gt; &lt;/P&gt;&lt;P&gt;could you augment the one main flow by update attribute that reads from DistributedMapCache if it's a small lookup:  &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.standard.PutDistributedMapCache/index.html" target="_blank"&gt;https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.standard.PutDistributedMapCache/index.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I like the idea of a mergeJSON processor though&lt;/P&gt;</description>
      <pubDate>Sat, 29 Oct 2016 00:14:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/NiFi-Creating-a-single-JSON-from-multiple-SQL-tables-in-NiFi/m-p/154846#M44765</guid>
      <dc:creator>TimothySpann</dc:creator>
      <dc:date>2016-10-29T00:14:29Z</dc:date>
    </item>
  </channel>
</rss>

