<?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: Get sql records count in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Get-sql-records-count/m-p/371191#M240919</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp;I tried the above but it spits out multiple flowfiles.I just need the count(1) value&lt;/P&gt;</description>
    <pubDate>Fri, 19 May 2023 16:12:01 GMT</pubDate>
    <dc:creator>nuxeo-nifi</dc:creator>
    <dc:date>2023-05-19T16:12:01Z</dc:date>
    <item>
      <title>Get sql records count</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Get-sql-records-count/m-p/371157#M240908</link>
      <description>&lt;P&gt;I would like to get records count(select count(1) from table where col1=‘abc’) from a sql table. Could someone please help me with that ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 06:41:20 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Get-sql-records-count/m-p/371157#M240908</guid>
      <dc:creator>nuxeo-nifi</dc:creator>
      <dc:date>2023-05-19T06:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: Get sql records count</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Get-sql-records-count/m-p/371184#M240916</link>
      <description>&lt;P&gt;You can use ExecuteSQL pr ExecuteSQLRecord Processor for that. The first one will give you the result in avro format and the second one you can specify the format of the output by setting the record writer property.&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 12:23:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Get-sql-records-count/m-p/371184#M240916</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2023-05-19T12:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: Get sql records count</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Get-sql-records-count/m-p/371191#M240919</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp;I tried the above but it spits out multiple flowfiles.I just need the count(1) value&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 16:12:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Get-sql-records-count/m-p/371191#M240919</guid>
      <dc:creator>nuxeo-nifi</dc:creator>
      <dc:date>2023-05-19T16:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Get sql records count</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Get-sql-records-count/m-p/371198#M240920</link>
      <description>&lt;P&gt;Can you please share the configuration for the executesql processor and any record writer you used. Also please share the flowfile output.&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 16:40:12 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Get-sql-records-count/m-p/371198#M240920</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2023-05-19T16:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Get sql records count</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Get-sql-records-count/m-p/371202#M240921</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nuxeonifi_0-1684515440053.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/37637iD096CE6AAFA46BCA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nuxeonifi_0-1684515440053.png" alt="nuxeonifi_0-1684515440053.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want the executeSQL to run just once and also if the count&amp;gt;0 then run another executeSQL to fetch records from another table&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 17:00:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Get-sql-records-count/m-p/371202#M240921</guid>
      <dc:creator>nuxeo-nifi</dc:creator>
      <dc:date>2023-05-19T17:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: Get sql records count</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Get-sql-records-count/m-p/371207#M240922</link>
      <description>&lt;P&gt;It seems like the ExecuteSQL is being executed continuously because its scheduled to run as such based on the Run Schedule. You have to set up the Run Schedule to the needed frequency by selecting CORN Driven Scheduling Strategy and set the CRON Time accordingly in the Run Schedule property.&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 18:14:37 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Get-sql-records-count/m-p/371207#M240922</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2023-05-19T18:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: Get sql records count</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Get-sql-records-count/m-p/371280#M240942</link>
      <description>&lt;P&gt;In this case, you will need some extra steps. You could try something like:&lt;BR /&gt;&lt;BR /&gt;You have an &lt;STRONG&gt;ExecuteSQLRecord&lt;/STRONG&gt; or &lt;STRONG&gt;ExecuteSQL&lt;/STRONG&gt;, configured with the &lt;STRONG&gt;Database Connection Pooling Service&lt;/STRONG&gt; and the&lt;STRONG&gt; Record Writer&lt;/STRONG&gt; (if using ExecuteSQLRecord).&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Next, I would &lt;STRONG&gt;link the success queue&lt;/STRONG&gt; to an &lt;STRONG&gt;ExtractText&lt;/STRONG&gt; Processor. In this Processor I would add a new property called &lt;STRONG&gt;number_of_rows&lt;/STRONG&gt; having the value &lt;STRONG&gt;" .* "&lt;/STRONG&gt;. This will &lt;STRONG&gt;extract the value&lt;/STRONG&gt; returned by count(*) and&lt;STRONG&gt; save it as an attribute&lt;/STRONG&gt; in your FlowFile.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Once you did this, you can &lt;STRONG&gt;link the success queue to an RouteOnAttribute&lt;/STRONG&gt; Processor. Here, you will define a new property named &lt;STRONG&gt;bigger_as_zero&lt;/STRONG&gt; and use the &lt;STRONG&gt;NiFi's EL&lt;/STRONG&gt; to validate if the&lt;STRONG&gt; attribute is bigger than zero or not&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If bigger, you will send that message to the processor in which you have linked this queue. &lt;STRONG&gt;Otherwise, meaning that the value is zero&lt;/STRONG&gt;, you can route the &lt;STRONG&gt;unmatched queue&lt;/STRONG&gt; to another &lt;STRONG&gt;ExecuteSQL&lt;/STRONG&gt;/ExecuteSQLRecord. You could also apply NiFi's EL to check if the &lt;STRONG&gt;value is exactly zero&lt;/STRONG&gt;, if that is what you are looking for and route the file accordingly.&lt;BR /&gt;&lt;BR /&gt;NiFi's EL: &lt;A href="https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html" target="_blank"&gt;https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Everything mentioned above has to be done, in addition to what &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt; already said, with the fact that you need to modify you running schedule from 0 seconds to a greater value. 0 means that you will constantly execute this SQL Record. Here you will have to modify the value based on your project's requirements.&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 13:55:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Get-sql-records-count/m-p/371280#M240942</guid>
      <dc:creator>cotopaul</dc:creator>
      <dc:date>2023-05-22T13:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: Get sql records count</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Get-sql-records-count/m-p/371392#M240968</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp; - it worked ! Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2023 15:47:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Get-sql-records-count/m-p/371392#M240968</guid>
      <dc:creator>nuxeo-nifi</dc:creator>
      <dc:date>2023-05-23T15:47:33Z</dc:date>
    </item>
  </channel>
</rss>

