<?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: How to update per query execution time in table? in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-update-per-query-execution-time-in-table/m-p/232698#M67090</link>
    <description>&lt;P&gt;Hi Matt,&lt;/P&gt;&lt;P&gt;I read your blog, I understand your groovy script.&lt;/P&gt;&lt;P&gt;but in my situation which processor I use,what is sequence of processor when i used the Executescript processor.&lt;/P&gt;&lt;P&gt;what is the changes in the script that provided in blog.&lt;/P&gt;</description>
    <pubDate>Wed, 23 Aug 2017 18:25:03 GMT</pubDate>
    <dc:creator>waghmithu</dc:creator>
    <dc:date>2017-08-23T18:25:03Z</dc:date>
    <item>
      <title>How to update per query execution time in table?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-update-per-query-execution-time-in-table/m-p/232695#M67087</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have Designed the bellow data flow&lt;/P&gt;&lt;P&gt;1 - -&amp;gt; 2 - ConvertAvroToJSON -&amp;gt; 3 - splitJSon -&amp;gt; 4 - EvaluateJsonPath -&amp;gt; 5 - UpdateAttribute -&amp;gt; 6 ExecuteSQL -&amp;gt; 7 - replaceText -&amp;gt; 8- putSQL.&lt;BR /&gt;&lt;BR /&gt;1 - 2 - 3 : query your table and split by row. You will have one flowfile by row. Use $ for the JsonPathExpression in the split processor.&lt;BR /&gt;&lt;BR /&gt;4 - Retrieve the query_id and the query_execute in two attributes of each flowfile (values of your properties are $.query_id and $.query_execute)&lt;BR /&gt;&lt;BR /&gt;5 - Create a new attribute query_startTime with the value ${now():format('HH:mm:ss')&lt;BR /&gt;&lt;BR /&gt;6 - Execute the query ${query_execute}&lt;BR /&gt;&lt;BR /&gt;7 - Write your insert query : INSERT INTO queryExecutionInfo VALUES (${query_id}, ${query_startTime},{${now():format('HH:mm:ss'));&lt;BR /&gt;&lt;BR /&gt;8 - Execute your insert&lt;/P&gt;&lt;P&gt;problem:&lt;/P&gt;&lt;P&gt;In 5th step query_startTime for all query is same&lt;/P&gt;&lt;P&gt;ExecuteSQL processor is required some time to execute the query.&lt;BR /&gt;after the first query execute the value are inserted into queryExecutionInfo table sucessfully.&lt;BR /&gt;but when second query execution completed the query_startTime same as first query_startTime and end time is different.&lt;BR /&gt;I have to insert second query_startTime as first query_endTime and vice versa.&lt;/P&gt;&lt;P&gt;Can someone point me at an example to get me going&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 21:09:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-update-per-query-execution-time-in-table/m-p/232695#M67087</guid>
      <dc:creator>waghmithu</dc:creator>
      <dc:date>2017-08-22T21:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to update per query execution time in table?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-update-per-query-execution-time-in-table/m-p/232696#M67088</link>
      <description>&lt;P&gt;Step 3 (SplitJson) is kind of a "barrier" processor, it will send out all flow files after they have been split (in order to add fragment.count to each flow file). Then steps 4&amp;amp;5 must be executing so quickly that each flow file gets the same query_startTime value. It sounds like you'd like to set query_startTime just as ExecuteSQL is about to execute the statement. Unfortunately I don't believe this is possible with ExecuteSQL (although please feel free to write a &lt;A target="_blank" href="https://issues.apache.org/jira/projects/NIFI"&gt;Jira&lt;/A&gt; to add this improvement). If you are comfortable with a scripting solution such as Groovy, check out &lt;A target="_blank" href="http://funnifi.blogspot.com/2016/04/sql-in-nifi-with-executescript.html"&gt;my blog post&lt;/A&gt; on how to do SQL using Groovy using the ExecuteScript processor in NiFi. You could modify that to add the query_startTime attribute just before calling the sql.rows() statement in the script&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 22:10:44 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-update-per-query-execution-time-in-table/m-p/232696#M67088</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2017-08-22T22:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to update per query execution time in table?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-update-per-query-execution-time-in-table/m-p/232697#M67089</link>
      <description>&lt;P&gt;thanks Matt for the reply,&lt;/P&gt;&lt;P&gt;can I used the attribute to store the query_startTime= query_endTime after the first query execution completed.&lt;/P&gt;&lt;P&gt;can I insert the attribute query_startTime and query_endTime after the second query execution and vice versa.&lt;/P&gt;&lt;P&gt;Please kindly guide me for the same.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 01:22:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-update-per-query-execution-time-in-table/m-p/232697#M67089</guid>
      <dc:creator>waghmithu</dc:creator>
      <dc:date>2017-08-23T01:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to update per query execution time in table?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-update-per-query-execution-time-in-table/m-p/232698#M67090</link>
      <description>&lt;P&gt;Hi Matt,&lt;/P&gt;&lt;P&gt;I read your blog, I understand your groovy script.&lt;/P&gt;&lt;P&gt;but in my situation which processor I use,what is sequence of processor when i used the Executescript processor.&lt;/P&gt;&lt;P&gt;what is the changes in the script that provided in blog.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2017 18:25:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-update-per-query-execution-time-in-table/m-p/232698#M67090</guid>
      <dc:creator>waghmithu</dc:creator>
      <dc:date>2017-08-23T18:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to update per query execution time in table?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-update-per-query-execution-time-in-table/m-p/232699#M67091</link>
      <description>&lt;P&gt;Since you're using a script, you could feasibly replace steps 4-7 above, but my blog post (plus adding your attribute) really only covers 5&amp;amp;6&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 21:21:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-update-per-query-execution-time-in-table/m-p/232699#M67091</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2017-08-24T21:21:28Z</dc:date>
    </item>
  </channel>
</rss>

