<?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 Inserting data (daily) of a specific date in Cassandra via Apache NIFI in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Inserting-data-daily-of-a-specific-date-in-Cassandra-via/m-p/197034#M73880</link>
    <description>&lt;P&gt;Hey,&lt;BR /&gt;&lt;BR /&gt;I want to import data of an ftp (which is updated daily) to cassandra by using Apache NIFI.&lt;BR /&gt;&lt;BR /&gt;I got the process so far, but i need to update my database every day with data of the day before.&lt;BR /&gt;&lt;BR /&gt;It would work when I m uploading the whole file every day, but I want to have just the new lines of this specific day(the day before) as a flow file.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;For example:&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;Todays date is &lt;STRONG&gt;2018-01-25&lt;/STRONG&gt; and the data on my ftp looks something like this:&lt;BR /&gt;&lt;BR /&gt;date(timestamp) abc ghi xyz&lt;BR /&gt;2018-01-23 11:00 Null 222 44&lt;BR /&gt;2018-01-23 12:00 Null 222 44&lt;BR /&gt;2018-01-23 13:00 Null 222 44&lt;BR /&gt;2018-01-23 14:00 Null 222 44&lt;BR /&gt;2018-01-23 15:00 Null 222 44&lt;BR /&gt;2018-01-24 11:00 Null 222 44&lt;BR /&gt;2018-01-24 12:00 Null 222 44&lt;BR /&gt;2018-01-24 13:00 Null 222 44&lt;BR /&gt;2018-01-24 14:00 Null 222 44&lt;BR /&gt;2018-01-24 15:00 Null 222 44&lt;BR /&gt;&lt;BR /&gt;Before inserting it to cassandra I convert it from csv to json, so it looks like this:&lt;BR /&gt;(date : YYYYmmDDhh)&lt;BR /&gt;&lt;BR /&gt;[{"xyz":"44","date":"2018012311","abc":"Null","ghi":"222"},&lt;BR /&gt;{"xyz":"44","date":"2018012312","abc":"Null","ghi":"222"},&lt;BR /&gt;{"xyz":"44","date":"2018012313","abc":"Null","ghi":"222"},&lt;BR /&gt;{"xyz":"44","date":"2018012314","abc":"Null","ghi":"222"},&lt;BR /&gt;{"xyz":"44","date":"2018012315","abc":"Null","ghi":"222"},&lt;BR /&gt;{"xyz":"44","date":"&lt;STRONG&gt;20180124&lt;/STRONG&gt;11","abc":"Null","ghi":"222"},&lt;BR /&gt;{"xyz":"44","date":"&lt;STRONG&gt;20180124&lt;/STRONG&gt;12","abc":"Null","ghi":"222"},&lt;BR /&gt;{"xyz":"44","date":"&lt;STRONG&gt;20180124&lt;/STRONG&gt;13","abc":"Null","ghi":"222"},&lt;BR /&gt;{"xyz":"44","date":"&lt;STRONG&gt;20180124&lt;/STRONG&gt;14","abc":"Null","ghi":"222"},&lt;BR /&gt;{"xyz":"44","date":"&lt;STRONG&gt;20180124&lt;/STRONG&gt;15","abc":"Null","ghi":"222"}]&lt;BR /&gt;&lt;BR /&gt;I want to replace my flowfile/extract now all data of date "&lt;STRONG&gt;20180124&lt;/STRONG&gt;" for my following processors.&lt;BR /&gt;&lt;BR /&gt;I thought about using a possibility to get the date one day ago by using the nifi express language: "${now():toNumber():minus(86400000):format('yyyyMMdd')}" - this shows me the date of yesterday.&lt;BR /&gt;But where do I have to set it up. What processor is recommended?&lt;BR /&gt;&lt;BR /&gt;Is it maybe possible as a regex in a Replace Text processor? Or an Extract Text Processor?&lt;BR /&gt;Something like: &lt;BR /&gt;Search value: ^.*(\{${now():toNumber():minus(86400000):format('yyyy-MM-dd')\}$ - I guess thats not how regex works though.&lt;/P&gt;&lt;P&gt;My process looks like: &lt;/P&gt;&lt;P&gt;ListFTP -&amp;gt; FetchFTP -&amp;gt; ConvertRecord (CSV to JSON) -&amp;gt; &lt;EM&gt;????? &lt;/EM&gt;-&amp;gt; SplitJSON -&amp;gt; EvaluateJSONPath/UpdateAttribute -&amp;gt; ReplaceText (insert into) -&amp;gt; PUTCassandraQL&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Any help is much appreciated!&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jan 2018 18:20:13 GMT</pubDate>
    <dc:creator>onestoneh</dc:creator>
    <dc:date>2018-01-25T18:20:13Z</dc:date>
    <item>
      <title>Inserting data (daily) of a specific date in Cassandra via Apache NIFI</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Inserting-data-daily-of-a-specific-date-in-Cassandra-via/m-p/197034#M73880</link>
      <description>&lt;P&gt;Hey,&lt;BR /&gt;&lt;BR /&gt;I want to import data of an ftp (which is updated daily) to cassandra by using Apache NIFI.&lt;BR /&gt;&lt;BR /&gt;I got the process so far, but i need to update my database every day with data of the day before.&lt;BR /&gt;&lt;BR /&gt;It would work when I m uploading the whole file every day, but I want to have just the new lines of this specific day(the day before) as a flow file.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;For example:&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;Todays date is &lt;STRONG&gt;2018-01-25&lt;/STRONG&gt; and the data on my ftp looks something like this:&lt;BR /&gt;&lt;BR /&gt;date(timestamp) abc ghi xyz&lt;BR /&gt;2018-01-23 11:00 Null 222 44&lt;BR /&gt;2018-01-23 12:00 Null 222 44&lt;BR /&gt;2018-01-23 13:00 Null 222 44&lt;BR /&gt;2018-01-23 14:00 Null 222 44&lt;BR /&gt;2018-01-23 15:00 Null 222 44&lt;BR /&gt;2018-01-24 11:00 Null 222 44&lt;BR /&gt;2018-01-24 12:00 Null 222 44&lt;BR /&gt;2018-01-24 13:00 Null 222 44&lt;BR /&gt;2018-01-24 14:00 Null 222 44&lt;BR /&gt;2018-01-24 15:00 Null 222 44&lt;BR /&gt;&lt;BR /&gt;Before inserting it to cassandra I convert it from csv to json, so it looks like this:&lt;BR /&gt;(date : YYYYmmDDhh)&lt;BR /&gt;&lt;BR /&gt;[{"xyz":"44","date":"2018012311","abc":"Null","ghi":"222"},&lt;BR /&gt;{"xyz":"44","date":"2018012312","abc":"Null","ghi":"222"},&lt;BR /&gt;{"xyz":"44","date":"2018012313","abc":"Null","ghi":"222"},&lt;BR /&gt;{"xyz":"44","date":"2018012314","abc":"Null","ghi":"222"},&lt;BR /&gt;{"xyz":"44","date":"2018012315","abc":"Null","ghi":"222"},&lt;BR /&gt;{"xyz":"44","date":"&lt;STRONG&gt;20180124&lt;/STRONG&gt;11","abc":"Null","ghi":"222"},&lt;BR /&gt;{"xyz":"44","date":"&lt;STRONG&gt;20180124&lt;/STRONG&gt;12","abc":"Null","ghi":"222"},&lt;BR /&gt;{"xyz":"44","date":"&lt;STRONG&gt;20180124&lt;/STRONG&gt;13","abc":"Null","ghi":"222"},&lt;BR /&gt;{"xyz":"44","date":"&lt;STRONG&gt;20180124&lt;/STRONG&gt;14","abc":"Null","ghi":"222"},&lt;BR /&gt;{"xyz":"44","date":"&lt;STRONG&gt;20180124&lt;/STRONG&gt;15","abc":"Null","ghi":"222"}]&lt;BR /&gt;&lt;BR /&gt;I want to replace my flowfile/extract now all data of date "&lt;STRONG&gt;20180124&lt;/STRONG&gt;" for my following processors.&lt;BR /&gt;&lt;BR /&gt;I thought about using a possibility to get the date one day ago by using the nifi express language: "${now():toNumber():minus(86400000):format('yyyyMMdd')}" - this shows me the date of yesterday.&lt;BR /&gt;But where do I have to set it up. What processor is recommended?&lt;BR /&gt;&lt;BR /&gt;Is it maybe possible as a regex in a Replace Text processor? Or an Extract Text Processor?&lt;BR /&gt;Something like: &lt;BR /&gt;Search value: ^.*(\{${now():toNumber():minus(86400000):format('yyyy-MM-dd')\}$ - I guess thats not how regex works though.&lt;/P&gt;&lt;P&gt;My process looks like: &lt;/P&gt;&lt;P&gt;ListFTP -&amp;gt; FetchFTP -&amp;gt; ConvertRecord (CSV to JSON) -&amp;gt; &lt;EM&gt;????? &lt;/EM&gt;-&amp;gt; SplitJSON -&amp;gt; EvaluateJSONPath/UpdateAttribute -&amp;gt; ReplaceText (insert into) -&amp;gt; PUTCassandraQL&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Any help is much appreciated!&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2018 18:20:13 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Inserting-data-daily-of-a-specific-date-in-Cassandra-via/m-p/197034#M73880</guid>
      <dc:creator>onestoneh</dc:creator>
      <dc:date>2018-01-25T18:20:13Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting data (daily) of a specific date in Cassandra via Apache NIFI</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Inserting-data-daily-of-a-specific-date-in-Cassandra-via/m-p/197035#M73881</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/48241/onestoneh.html" nodeid="48241" target="_blank"&gt;@Salda Murrah&lt;/A&gt;&lt;PRE&gt;ListFTP -&amp;gt; FetchFTP -&amp;gt; ConvertRecord (CSV to JSON)
-&amp;gt; SplitJSON //split the json array to individual messages
-&amp;gt; EvaluateJSONPath //extract date value and keep it as attribute
-&amp;gt; RouteonAttribute //check date attribute value is it contains last day date or not
-&amp;gt; ReplaceText (insert into) -&amp;gt; PUTCassandraQL&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;SplitJson Configs:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;JsonPath Expression&lt;/P&gt;&lt;PRE&gt;$.*&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="56456-splitjson.png" style="width: 1305px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17870iD056E3E44B73BA51/image-size/medium?v=v2&amp;amp;px=400" role="button" title="56456-splitjson.png" alt="56456-splitjson.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;EvaluateJsonPath Configs:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Destination&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;flowfile-attribute&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;date&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;$.date&lt;/PRE&gt;
&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="56457-eval-json.png" style="width: 1391px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17871iAE190FD965960C1F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="56457-eval-json.png" alt="56457-eval-json.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;if you want you can add more properties and all those values will be added as flowfile attributes.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Routeonattribute Configs:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Routing Strategy&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;Route to Property name&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;yesterday&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;${date:contains("${now():toNumber():minus(86400000):format('yyyyMMdd')}")}&lt;/PRE&gt;
&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="56458-routeonattribute.png" style="width: 2379px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17872i05DC287A76204CCD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="56458-routeonattribute.png" alt="56458-routeonattribute.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Connect&lt;STRONG&gt; Yesterday&lt;/STRONG&gt; relation to next &lt;STRONG&gt;Replace text processor&lt;/STRONG&gt; so route on attribute processor only gives &lt;STRONG&gt;date attribute that having yesterday's date in it&lt;/STRONG&gt;(we are comparing by using &lt;STRONG&gt;contain function&lt;/STRONG&gt; i.e expression checks if the date attribute contains 20180124 or not).&lt;/P&gt;&lt;P&gt;Then in replace text processor prepare your insert into statement then use PUTCassandraQL processor.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;If the Answer helped to resolve your issue,&lt;STRONG&gt; Click on Accept button below to accept the answer, &lt;/STRONG&gt;That would be great help to Community users to find solution quickly for these kind of errors.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 06:21:35 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Inserting-data-daily-of-a-specific-date-in-Cassandra-via/m-p/197035#M73881</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2019-08-18T06:21:35Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting data (daily) of a specific date in Cassandra via Apache NIFI</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Inserting-data-daily-of-a-specific-date-in-Cassandra-via/m-p/197036#M73882</link>
      <description>&lt;P&gt;Thats works very well, thank you once again.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 00:07:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Inserting-data-daily-of-a-specific-date-in-Cassandra-via/m-p/197036#M73882</guid>
      <dc:creator>onestoneh</dc:creator>
      <dc:date>2018-01-26T00:07:02Z</dc:date>
    </item>
  </channel>
</rss>

