<?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: Can executesql processor  store state for incremental loading in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Can-executesql-processor-store-state-for-incremental-loading/m-p/224979#M186842</link>
    <description>&lt;P&gt;Done &lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt; . I have accepted &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 27 Apr 2018 15:28:38 GMT</pubDate>
    <dc:creator>abhinav_joshi</dc:creator>
    <dc:date>2018-04-27T15:28:38Z</dc:date>
    <item>
      <title>Can executesql processor  store state for incremental loading</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Can-executesql-processor-store-state-for-incremental-loading/m-p/224975#M186838</link>
      <description>&lt;P&gt;Hi all..i need to  incrementally ingest data from rdbms using nifi.now i know i can use "query database table" processor  which stores a state value on the basis of which incremental or streaming ingestion  can be attempted. But my source query fetches data by joining 2 tables ..now in this case i cant use query database as here i can only use only one table and executesql processor doest have the provision to store state..any ideas on how this can be implemented&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 13:07:46 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Can-executesql-processor-store-state-for-incremental-loading/m-p/224975#M186838</guid>
      <dc:creator>abhinav_joshi</dc:creator>
      <dc:date>2022-09-16T13:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: Can executesql processor  store state for incremental loading</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Can-executesql-processor-store-state-for-incremental-loading/m-p/224976#M186839</link>
      <description>&lt;P&gt;I can only use only one table and &lt;A href="http://may2018calendar.info/holiday/"&gt;execute&lt;/A&gt; processor does have the &lt;A href="http://may2018calendar.info/portrait-landscape/"&gt;provision&lt;/A&gt; to store state..any ideas on how this can be implemented&lt;/P&gt;</description>
      <pubDate>Sat, 21 Apr 2018 18:50:20 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Can-executesql-processor-store-state-for-incremental-loading/m-p/224976#M186839</guid>
      <dc:creator>102jilan</dc:creator>
      <dc:date>2018-04-21T18:50:20Z</dc:date>
    </item>
    <item>
      <title>Re: Can executesql processor  store state for incremental loading</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Can-executesql-processor-store-state-for-incremental-loading/m-p/224977#M186840</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/70516/abhinavjoshi.html" nodeid="70516" target="_blank"&gt;@Abhinav Joshi&lt;/A&gt;&lt;/P&gt;&lt;P&gt;As you are Fetching results of Join in this case, We need to store the state in DistributeMapCache/HDFS/Hive/Hbase and then pull the state value from DistributeMapCache/HDFS/Hive/Hbase and use that value as lower bound, run the join incrementally.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Example:-&lt;/U&gt;&lt;/STRONG&gt;&lt;BR /&gt;As i'm having emp,dept tables with &lt;STRONG&gt;joindate(timestamp datatype)&lt;/STRONG&gt; as incremental column name in &lt;STRONG&gt;emp &lt;/STRONG&gt;table.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Flow:-&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="68585-incremental-executesql-flow.png" style="width: 2630px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/15451i4FD9A0DB7CA897FC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="68585-incremental-executesql-flow.png" alt="68585-incremental-executesql-flow.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Flow Explanation:-&lt;/U&gt;&lt;BR /&gt;1.GenerateFlowFile processor:-&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;This processor will be trigger for the flow and Added a new property &lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;increment.value&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;cache_key&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;2.FetchDistributeMapCache:-&lt;/STRONG&gt;&lt;BR /&gt;Configure and enable DistributedMapCacheClientService and change the below property values&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Cache Entry Identifier
&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;${increment.value}&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Distributed Cache Service
&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;DistributedMapCacheClientService&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Put Cache Value In Attribute
&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;stored.state //if found then the value will be added to the flowfile as a attribute with name as stored.state&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="68586-fetchdistributedcache.png" style="width: 1466px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/15452iF3B572152B3BE39F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="68586-fetchdistributedcache.png" alt="68586-fetchdistributedcache.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;3.UpdateAttribute:-&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;We have feeded both success/not-found relations to Update Attribute processor&lt;/P&gt;&lt;P&gt;Add two properties &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;current.state
&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;${now():format("yyyy-MM-dd HH:mm:ss")} //current timestamp as current.state attribute&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;stored.state
&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;${stored.state:isNull():ifElse('1900-01-01 12:00:00','${stored.state}')} //if the value is null(in first run) then we are changing as 1900-01-01 12:00:00 and if the value is presented then we are keeping as is.&lt;/PRE&gt;
&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="68588-updateattribute.png" style="width: 2345px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/15453i72D48F0B19A7A31F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="68588-updateattribute.png" alt="68588-updateattribute.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can change the &lt;STRONG&gt;default value, stored/current.state values &lt;/STRONG&gt;as per your requirements.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;4.ExecuteSql:-&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;SQL select query&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;select e.id,d.name from 
emp e join
dept d
on e.deptid=d.deptid
where 
 e.joindate &amp;gt; '${stored.state}' 
and 
 e.joindate &amp;gt; '${current.state}'
&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;as my emp table having joindate as incremental column so i have used &lt;STRONG&gt;stored.state&lt;/STRONG&gt; and &lt;STRONG&gt;current.state &lt;/STRONG&gt;attribute values in my join where clause to run incrementally.&lt;/P&gt;&lt;P&gt;--&lt;BR /&gt;Fork the success relation from executesql processor &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Fork1:&lt;/STRONG&gt; to stored the current.state in distributecache&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Fork2:&lt;/STRONG&gt; For other processing &lt;/P&gt;&lt;P&gt;--&lt;BR /&gt;&lt;U&gt;Fork1:To store the state:-&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;5.Replace Text:-&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Search Value
&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;(?s)(^.*$)&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Replacement Value
&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;${current.state}&lt;/PRE&gt;
&lt;/DIV&gt;&lt;P&gt;Replacement Strategy&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;Always Replace&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;Evaluation Mode&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;Entire text&lt;/PRE&gt;
&lt;/DIV&gt;&lt;P&gt;Now we are changing the flowfile content with current.state value as new flowfile content.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;-&lt;BR /&gt;6.PutDistributeCacheMap:-&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Cache Entry Identifier
&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;${increment.value}&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="68589-putdistributecache.png" style="width: 1436px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/15454i0A8B33EB105FF7AB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="68589-putdistributecache.png" alt="68589-putdistributecache.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;-&lt;BR /&gt;&lt;U&gt;Fork2:-Further processing &lt;/U&gt;&lt;BR /&gt;like processing (or) storing the results to HDFS..etc&lt;/P&gt;&lt;P&gt;I have attached sample template below save/upload template to your NiFi instancce and change the configs as per your requirements.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.cloudera.com/legacyfs/online/attachments/68587-executesql-storestate-187764.xml" target="_blank"&gt;executesql-storestate-187764.xml&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 01:38:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Can-executesql-processor-store-state-for-incremental-loading/m-p/224977#M186840</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2019-08-18T01:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: Can executesql processor  store state for incremental loading</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Can-executesql-processor-store-state-for-incremental-loading/m-p/224978#M186841</link>
      <description>&lt;P&gt;Hey &lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt; thanks a million for taking the pain to provide such a great answer and too so detailed at every step. Really appreciate this !! .. great stuff ..thanks again&lt;/P&gt;</description>
      <pubDate>Sun, 22 Apr 2018 04:21:53 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Can-executesql-processor-store-state-for-incremental-loading/m-p/224978#M186841</guid>
      <dc:creator>abhinav_joshi</dc:creator>
      <dc:date>2018-04-22T04:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: Can executesql processor  store state for incremental loading</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Can-executesql-processor-store-state-for-incremental-loading/m-p/224979#M186842</link>
      <description>&lt;P&gt;Done &lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt; . I have accepted &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2018 15:28:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Can-executesql-processor-store-state-for-incremental-loading/m-p/224979#M186842</guid>
      <dc:creator>abhinav_joshi</dc:creator>
      <dc:date>2018-04-27T15:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: Can executesql processor  store state for incremental loading</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Can-executesql-processor-store-state-for-incremental-loading/m-p/224980#M186843</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt; &lt;A rel="user" href="https://community.cloudera.com/users/641/mburgess.html" nodeid="641"&gt;@Matt Burgess&lt;/A&gt; I am using NiFi 1.1 and ifElse is not availabile in that. In NiFi 1.1, how can I evaluate stored.state in UpdateAttribute?&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jan 2019 07:27:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Can-executesql-processor-store-state-for-incremental-loading/m-p/224980#M186843</guid>
      <dc:creator>raghupradeepl</dc:creator>
      <dc:date>2019-01-23T07:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: Can executesql processor  store state for incremental loading</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Can-executesql-processor-store-state-for-incremental-loading/m-p/224981#M186844</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt; ,&lt;/P&gt;&lt;P&gt;I am trying to upload the above template but I am getting below error&lt;/P&gt;&lt;P&gt;Error :&lt;/P&gt;&lt;P&gt;"Found bundle org.apache.nifi:nifi-update-attribute-nar:1.6.0 but does not support org.apache.nifi.processors.attributes.UpdateAttribute"&lt;/P&gt;&lt;P&gt;Could you please confirm if we need nifi-update-attribute-nar nar file?&lt;/P&gt;&lt;P&gt;In my requirement, I am joining 5 tables to retrieve incremental data based record_create_date&lt;/P&gt;&lt;P&gt;every second data is populated on these tables, I need to retrieve the data incrementally and flowfile should remember the last record_create_date it successfully pulled.&lt;/P&gt;&lt;P&gt;in the above example if I query&lt;/P&gt;&lt;P&gt;e.joindate &amp;gt;'${stored.state}'&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;e.joindate &amp;gt;'${current.state}' (it has current time), it will never fetch new records, right?&lt;/P&gt;&lt;P&gt;For distributed cache it is asking for Server Hostname and port, what should be the server for this?&lt;/P&gt;&lt;P&gt;Where I am setting the last fetched date (joindate) to ${stored.state}&lt;/P&gt;&lt;P&gt;Could you please clarify me on my doubt?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;~Sri&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 06:04:59 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Can-executesql-processor-store-state-for-incremental-loading/m-p/224981#M186844</guid>
      <dc:creator>srinatha_ananth</dc:creator>
      <dc:date>2019-01-24T06:04:59Z</dc:date>
    </item>
  </channel>
</rss>

