<?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>topic How do you get the NB_LINE_INSERTED from a tDBOutput with parallel iterations and execution. in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-do-you-get-the-NB-LINE-INSERTED-from-a-tDBOutput-with/m-p/2373975#M136635</link>
    <description>&lt;P&gt;I have a job that uses a source table that holds configuration data. It flows to an iterate then tjavarow to set some connection information. The truncate uses dynamic vars from the configuration table as well as the source and output components. The dboutput sets the parallel also in this way and uses the dynamic schema. This all works just fine however I have lost the ability to see how long each iteration takes for the dbinput and row count / seconds. that would be displayed in the TAC if it was all individual source and destinations.&lt;/P&gt;&lt;P&gt;I want to get the time taken for the insert and number of rows for each iteration. I am using parallel iterations and parallelism on the dbinsert for performance. Some tables take 1min others take 20min.&lt;/P&gt;&lt;P&gt;I can't figure out how to get the ((Integer)globalMap.get("tDBOutput_1_NB_LINE_INSERTED")) after each individual iteration. I can get it after the subjob&amp;nbsp;but it is only the last one. Any ideas how to get this.&lt;/P&gt;&lt;P&gt;I would settle for the screen output but eventually want to log to a file and then email that file.&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 01:43:12 GMT</pubDate>
    <dc:creator>BendingUnit22</dc:creator>
    <dc:date>2024-11-16T01:43:12Z</dc:date>
    <item>
      <title>How do you get the NB_LINE_INSERTED from a tDBOutput with parallel iterations and execution.</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-do-you-get-the-NB-LINE-INSERTED-from-a-tDBOutput-with/m-p/2373975#M136635</link>
      <description>&lt;P&gt;I have a job that uses a source table that holds configuration data. It flows to an iterate then tjavarow to set some connection information. The truncate uses dynamic vars from the configuration table as well as the source and output components. The dboutput sets the parallel also in this way and uses the dynamic schema. This all works just fine however I have lost the ability to see how long each iteration takes for the dbinput and row count / seconds. that would be displayed in the TAC if it was all individual source and destinations.&lt;/P&gt;&lt;P&gt;I want to get the time taken for the insert and number of rows for each iteration. I am using parallel iterations and parallelism on the dbinsert for performance. Some tables take 1min others take 20min.&lt;/P&gt;&lt;P&gt;I can't figure out how to get the ((Integer)globalMap.get("tDBOutput_1_NB_LINE_INSERTED")) after each individual iteration. I can get it after the subjob&amp;nbsp;but it is only the last one. Any ideas how to get this.&lt;/P&gt;&lt;P&gt;I would settle for the screen output but eventually want to log to a file and then email that file.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 01:43:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-do-you-get-the-NB-LINE-INSERTED-from-a-tDBOutput-with/m-p/2373975#M136635</guid>
      <dc:creator>BendingUnit22</dc:creator>
      <dc:date>2024-11-16T01:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do you get the NB_LINE_INSERTED from a tDBOutput with parallel iterations and execution.</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-do-you-get-the-NB-LINE-INSERTED-from-a-tDBOutput-with/m-p/2373976#M136636</link>
      <description>&lt;P&gt;@Bolter44, Would you mind trying the scenario as below with help of global variables in loop based on your iterations:&lt;span class="lia-inline-image-display-wrapper" image-alt="0693p000009I8VfAAK.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/132460i7CF17A015FC2206C/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p000009I8VfAAK.png" alt="0693p000009I8VfAAK.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0693p000009I8VpAAK.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/145831iB600440F1ABF8207/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p000009I8VpAAK.png" alt="0693p000009I8VpAAK.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper" image-alt="0693p000009I8VuAAK.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/142610i03E163EFBBA0E75E/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p000009I8VuAAK.png" alt="0693p000009I8VuAAK.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Aug 2020 06:35:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-do-you-get-the-NB-LINE-INSERTED-from-a-tDBOutput-with/m-p/2373976#M136636</guid>
      <dc:creator>vikramk</dc:creator>
      <dc:date>2020-08-08T06:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: How do you get the NB_LINE_INSERTED from a tDBOutput with parallel iterations and execution.</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-do-you-get-the-NB-LINE-INSERTED-from-a-tDBOutput-with/m-p/2373977#M136637</link>
      <description>&lt;P&gt;I have parallel iterations however I changed to no parallel and added this to the tjava.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* setup for logging */&lt;/P&gt;&lt;P&gt;row3.SourceDB = (String)globalMap.get("RefreshList.SOURCE_DB");&lt;/P&gt;&lt;P&gt;row3.SourcOwner = (String)globalMap.get("RefreshList.SOURCE_OWNER");&lt;/P&gt;&lt;P&gt;row3.SourceObject = (String)globalMap.get("RefreshList.SOURCE_TABLE");&lt;/P&gt;&lt;P&gt;row3.Parallelism = (Integer)globalMap.get("RefreshList.DEST_PARALLEL");&lt;/P&gt;&lt;P&gt;row3.ProcessedRows = ((Integer)globalMap.get("tDBOutput_1_NB_LINE_INSERTED"));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first four are always populated correctly. The tDBOutput_1_NB_LINE_INSERTED only got one value through the iteration.&lt;/P&gt;&lt;P&gt;[statistics] connecting to socket on port 3587&lt;/P&gt;&lt;P&gt;statistics] connected&lt;/P&gt;&lt;P&gt;PROD|PAYROLL|PERDTOT|6|6030007|&lt;/P&gt;&lt;P&gt;ODS|GENERAL|GOBEACC|2|6030007|&lt;/P&gt;&lt;P&gt;UNCP|WA_CONF|TRANSACTION|2|6030007|&lt;/P&gt;&lt;P&gt;PROD|PAYROLL|PERETOT|2|6030007|&lt;/P&gt;&lt;P&gt;[statistics] disconnected&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Aug 2020 16:10:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-do-you-get-the-NB-LINE-INSERTED-from-a-tDBOutput-with/m-p/2373977#M136637</guid>
      <dc:creator>BendingUnit22</dc:creator>
      <dc:date>2020-08-08T16:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do you get the NB_LINE_INSERTED from a tDBOutput with parallel iterations and execution.</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-do-you-get-the-NB-LINE-INSERTED-from-a-tDBOutput-with/m-p/2373978#M136638</link>
      <description>&lt;P&gt;Hello,To begin, if you use the insert in parallel at the DB level, you will not be able to retrieve the insert number, because it uses multi threading and it is not able to set the exact number due to the random operation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is an approach that will allow you to recover this value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I see that you are truncate the table before insertion, which is practical and makes things easier.&lt;/P&gt;&lt;P&gt;You can leave your design and just make a little addition. After insertion you can use these two components below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0693p000009IHCIAA4.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/128490i23A94C3F5EF3A42B/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p000009IHCIAA4.png" alt="0693p000009IHCIAA4.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The query For SQL Server: &lt;A href="https://dataedo.com/kb/query/sql-server" alt="https://dataedo.com/kb/query/sql-server" target="_blank"&gt;https://dataedo.com/kb/query/sql-server&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;select schema_name(tab.schema_id) + '.' + tab.name as [table],&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sum(part.rows) as [rows]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;from sys.tables tab&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;inner join sys.partitions part&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;on tab.object_id = part.object_id&lt;/P&gt;&lt;P&gt;where part.index_id IN (1, 0) -- 0 - table without PK, 1 table with PK&lt;/P&gt;&lt;P&gt;group by schema_name(tab.schema_id) + '.' + tab.name&lt;/P&gt;&lt;P&gt;order by sum(part.rows) desc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first allows to delay a little the time to insert all the data, you can put 5 seconds or more if you wish.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The second allows you to query the database and retrieve the number of records. being that you are truncate the table, you will have correct values. You store this in a global variable that you can use later.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If by chance, there is already data in your table, you can execute the same query before the insertion and after the insertion. Then you make a difference to get the exact number.&lt;/P&gt;&lt;P&gt;especially do not hesitate if you need more explanation&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2020 09:00:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-do-you-get-the-NB-LINE-INSERTED-from-a-tDBOutput-with/m-p/2373978#M136638</guid>
      <dc:creator>JohnRMK</dc:creator>
      <dc:date>2020-08-11T09:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do you get the NB_LINE_INSERTED from a tDBOutput with parallel iterations and execution.</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-do-you-get-the-NB-LINE-INSERTED-from-a-tDBOutput-with/m-p/2373979#M136639</link>
      <description>&lt;P&gt;I could not get it to work with the parallel set in the tDBOutput. So I changed the iterations to 8 so it can move through the list.
&lt;span class="lia-inline-image-display-wrapper" image-alt="0693p000009IOG7AAO.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/149838iD8DB29711843DECF/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p000009IOG7AAO.png" alt="0693p000009IOG7AAO.png" /&gt;&lt;/span&gt;In the first tJava I added:
// Start time for each iteration
globalMap.put("IterateStart_"+((Integer)globalMap.get("tFlowToIterate_4_CURRENT_ITERATION")) , TalendDate.getCurrentDate());

to dynamically increment a global var that sets the start time for each iteration in parallel.&lt;/P&gt;&lt;P&gt;
&lt;/P&gt;&lt;P&gt;Then on the tDBoutput I used the On Component OK -&amp;gt; tJava

I added in second tJava:
LogRow.StartTime = (Date)(globalMap.get("IterateStart_"+((Integer)globalMap.get("tFlowToIterate_4_CURRENT_ITERATION"))));
to get the current start for the iteration.

&lt;/P&gt;&lt;P&gt;LogRow.EndTime = TalendDate.getCurrentDate();
LogRow.RunTime = TalendDate.diffDate(LogRow.EndTime,LogRow.StartTime,"SS");&lt;/P&gt;&lt;P&gt;
&lt;/P&gt;&lt;P&gt;to get the number of minuts it ran for. It will show 0 for less than 1 but that is OK.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The enitre loging code lools like:
/* setup for logging */
LogRow.SourceDB = (String)globalMap.get("RefreshList.SOURCE_DB");LogRow.SourceOwner = (String)globalMap.get("RefreshList.SOURCE_OWNER");LogRow.SourceObject = (String)globalMap.get("RefreshList.SOURCE_TABLE");LogRow.Parallelism = (Integer)globalMap.get("RefreshList.DEST_PARALLEL");LogRow.ProcessedRows = ((Integer)globalMap.get("tDBOutput_1_NB_LINE"));LogRow.StartTime = (Date)(globalMap.get("IterateStart_"+((Integer)globalMap.get("tFlowToIterate_4_CURRENT_ITERATION"))));LogRow.EndTime = TalendDate.getCurrentDate();LogRow.RunTime = TalendDate.diffDate(LogRow.EndTime,LogRow.StartTime,"SS"); LogRow.Errors = ((String)globalMap.get("tDBOutput_1_ERROR_MESSAGE"));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then made a schema to a tlogrow but will be used log to a file.
&lt;span class="lia-inline-image-display-wrapper" image-alt="0693p000009IOLgAAO.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/148743i1F0733CD74326C0D/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p000009IOLgAAO.png" alt="0693p000009IOLgAAO.png" /&gt;&lt;/span&gt;
&lt;/P&gt;&lt;P&gt;It is working. i wish talend would figgure a nice way to get some stats when you are using parallel on the dboutput and in iterations.

Thanks to the other posters on this to give me some ideas to get it done.

&lt;/P&gt;&lt;P&gt;Hope this may help others too.&lt;/P&gt;&lt;P&gt;
&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2020 22:24:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-do-you-get-the-NB-LINE-INSERTED-from-a-tDBOutput-with/m-p/2373979#M136639</guid>
      <dc:creator>BendingUnit22</dc:creator>
      <dc:date>2020-08-11T22:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do you get the NB_LINE_INSERTED from a tDBOutput with parallel iterations and execution.</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-do-you-get-the-NB-LINE-INSERTED-from-a-tDBOutput-with/m-p/2373980#M136640</link>
      <description>&lt;P&gt;Did you try my solution with the query ? &lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 08:16:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-do-you-get-the-NB-LINE-INSERTED-from-a-tDBOutput-with/m-p/2373980#M136640</guid>
      <dc:creator>JohnRMK</dc:creator>
      <dc:date>2020-08-12T08:16:39Z</dc:date>
    </item>
  </channel>
</rss>

