<?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 Re: ConvertJSONtoSQL Issue: How to get unmatched Columns? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/ConvertJSONtoSQL-Issue-How-to-get-unmatched-Columns/m-p/306995#M223022</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/78508"&gt;@ang_coder&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure if i get you right and haven't done such a thing myselfe until now.&lt;BR /&gt;&lt;BR /&gt;But if you use &lt;STRONG&gt;PutDatabaseRecord&lt;/STRONG&gt; instead of PutSQL you have to specify a &lt;STRONG&gt;RecordReader&lt;/STRONG&gt;. This will be configured as ControllerService and you can add a schema in AvroSchemaRegistry (also in ControllerServices). In this schema provide the full table definition with default values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;f.e. {&lt;BR /&gt;"name" : "zeichen",&lt;BR /&gt;"type" : ["string","&lt;STRONG&gt;null&lt;/STRONG&gt;"]&lt;BR /&gt;},...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suppose that all columns which are not included by your flowfile should be taken from the schema considering the default values.&lt;/P&gt;</description>
    <pubDate>Fri, 04 Dec 2020 09:03:58 GMT</pubDate>
    <dc:creator>justenji</dc:creator>
    <dc:date>2020-12-04T09:03:58Z</dc:date>
    <item>
      <title>ConvertJSONtoSQL Issue: How to get unmatched Columns?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/ConvertJSONtoSQL-Issue-How-to-get-unmatched-Columns/m-p/306891#M223016</link>
      <description>&lt;P&gt;I am using ConvertJSONtoSQL to convert simple JSON to a SQL statement for inserting rows in DB2. I am using ConvertJSONtoSQL and PutSQL to write to DB2, but it is omitting the unmatched columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I add unmatched columns to the SQL? Is there a way to add the matching names in the JSON prior to running ConvertJSONtoSQL?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using AttributestoJSON but it didn't work. Can someone please help me?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 23:59:45 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/ConvertJSONtoSQL-Issue-How-to-get-unmatched-Columns/m-p/306891#M223016</guid>
      <dc:creator>ang_coder</dc:creator>
      <dc:date>2020-12-03T23:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: ConvertJSONtoSQL Issue: How to get unmatched Columns?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/ConvertJSONtoSQL-Issue-How-to-get-unmatched-Columns/m-p/306995#M223022</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/78508"&gt;@ang_coder&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure if i get you right and haven't done such a thing myselfe until now.&lt;BR /&gt;&lt;BR /&gt;But if you use &lt;STRONG&gt;PutDatabaseRecord&lt;/STRONG&gt; instead of PutSQL you have to specify a &lt;STRONG&gt;RecordReader&lt;/STRONG&gt;. This will be configured as ControllerService and you can add a schema in AvroSchemaRegistry (also in ControllerServices). In this schema provide the full table definition with default values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;f.e. {&lt;BR /&gt;"name" : "zeichen",&lt;BR /&gt;"type" : ["string","&lt;STRONG&gt;null&lt;/STRONG&gt;"]&lt;BR /&gt;},...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suppose that all columns which are not included by your flowfile should be taken from the schema considering the default values.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 09:03:58 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/ConvertJSONtoSQL-Issue-How-to-get-unmatched-Columns/m-p/306995#M223022</guid>
      <dc:creator>justenji</dc:creator>
      <dc:date>2020-12-04T09:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: ConvertJSONtoSQL Issue: How to get unmatched Columns?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/ConvertJSONtoSQL-Issue-How-to-get-unmatched-Columns/m-p/307005#M223023</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/78508"&gt;@ang_coder&lt;/a&gt;&amp;nbsp;&amp;nbsp; Tried it myself and have to correct my idea a little bit. Have a look at my example.&lt;BR /&gt;Here are my &lt;STRONG&gt;tables&lt;/STRONG&gt;. The target table has two columns more than the source.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tables" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/29700i678153188E4F9AEE/image-size/large?v=v2&amp;amp;px=999" role="button" title="HCC_unmatchedColumns_tables.png" alt="Tables" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Tables&lt;/span&gt;&lt;/span&gt;&lt;BR /&gt;I defined following &lt;STRONG&gt;ControllerServices&lt;/STRONG&gt;:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ControllerServices" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/29701i4099146236ADD97D/image-size/large?v=v2&amp;amp;px=999" role="button" title="HCC_unmatchedColumns_ControllerServices.png" alt="ControllerServices" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;ControllerServices&lt;/span&gt;&lt;/span&gt;&lt;BR /&gt;And created this &lt;STRONG&gt;flow&lt;/STRONG&gt;:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Flow" style="width: 854px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/29702i3EFAD2A6827CAA37/image-size/large?v=v2&amp;amp;px=999" role="button" title="HCC_unmatchedColumns_flow.png" alt="Flow" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Flow&lt;/span&gt;&lt;/span&gt;&lt;BR /&gt;Here the information of the single &lt;STRONG&gt;processors&lt;/STRONG&gt;:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Processor information" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/29703i9F8B3F00AFEB3FF1/image-size/large?v=v2&amp;amp;px=999" role="button" title="HCC_unmatchedColumns_processors.png" alt="Processor information" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Processor information&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In my example it works.&lt;BR /&gt;Sure there will be a more elegant solution but I don't know how.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 10:40:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/ConvertJSONtoSQL-Issue-How-to-get-unmatched-Columns/m-p/307005#M223023</guid>
      <dc:creator>justenji</dc:creator>
      <dc:date>2020-12-04T10:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: ConvertJSONtoSQL Issue: How to get unmatched Columns?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/ConvertJSONtoSQL-Issue-How-to-get-unmatched-Columns/m-p/307112#M223091</link>
      <description>&lt;P&gt;Can you please tell me where did you set the AvroSchemaRegistry? Since you are retrieving the data from SQL DB, you are getting it as Avro format. My incoming data is json format. So how can I use my flow file directly in Update Attribute and use in ConvertRecord? Does it make sense?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 18:39:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/ConvertJSONtoSQL-Issue-How-to-get-unmatched-Columns/m-p/307112#M223091</guid>
      <dc:creator>ang_coder</dc:creator>
      <dc:date>2020-12-07T18:39:29Z</dc:date>
    </item>
    <item>
      <title>Re: ConvertJSONtoSQL Issue: How to get unmatched Columns?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/ConvertJSONtoSQL-Issue-How-to-get-unmatched-Columns/m-p/307142#M223111</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/78508"&gt;@ang_coder&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The &lt;STRONG&gt;AvroSchemaRegistry&lt;/STRONG&gt; is to set in the &lt;STRONG&gt;ControllerServices&lt;/STRONG&gt;.&lt;BR /&gt;If it should be available in your whole NiFi just go to the canvas and click anywhere right -&amp;gt; choose "Configure". It is the same place where you define your database connections.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Configure -&amp;gt; ControllerServices" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/29729i95340D327494E2E3/image-size/large?v=v2&amp;amp;px=999" role="button" title="2020-12-08_HCC_unmatchedColumns.png" alt="Configure -&amp;gt; ControllerServices" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Configure -&amp;gt; ControllerServices&lt;/span&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;If you already have JSON-format just ignore the first two steps of my example flow where data were retrieved and converted to JSON.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Start with your JSON at &lt;STRONG&gt;UpdateAttribute&lt;/STRONG&gt; which doesn't care about the kind of flowfile content.&lt;BR /&gt;The &lt;STRONG&gt;ConvertRecord&lt;/STRONG&gt; in my example uses an JSON-reader and JSON-writer where the &lt;STRONG&gt;writer points to the AvroSchemaRegistry&lt;/STRONG&gt; with the &lt;STRONG&gt;schema.name&lt;/STRONG&gt; set in UpdateAttribute. Therefore the JsonRecordSetWriter_IJ_TestMoreColumnsAtTarget (just to take a short name) has the specification "Schema Access Strategy" with option "&lt;STRONG&gt;Use Schema.Name Property&lt;/STRONG&gt;". Have a look at the configuration details in my post before.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 07:41:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/ConvertJSONtoSQL-Issue-How-to-get-unmatched-Columns/m-p/307142#M223111</guid>
      <dc:creator>justenji</dc:creator>
      <dc:date>2020-12-08T07:41:30Z</dc:date>
    </item>
    <item>
      <title>Re: ConvertJSONtoSQL Issue: How to get unmatched Columns?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/ConvertJSONtoSQL-Issue-How-to-get-unmatched-Columns/m-p/307200#M223158</link>
      <description>&lt;P&gt;thank you very much! This works.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 19:04:13 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/ConvertJSONtoSQL-Issue-How-to-get-unmatched-Columns/m-p/307200#M223158</guid>
      <dc:creator>ang_coder</dc:creator>
      <dc:date>2020-12-08T19:04:13Z</dc:date>
    </item>
  </channel>
</rss>

