<?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 Re: Retrieve autoincremented primary key Id for each inserted row and use it in second table in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311898#M82899</link>
    <description>&lt;P&gt;Thanks after read your valuable inputs I have get the PK from table.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Aug 2019 13:17:12 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-08-02T13:17:12Z</dc:date>
    <item>
      <title>Retrieve autoincremented primary key Id for each inserted row and use it in second table</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311887#M82888</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Currently I have input source oracle data which I try to save it to table_A which is PostgreSQL database and this table has auto-incremented primary key.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;We have below 2 questions:&lt;/P&gt; 
&lt;P&gt;1] Once we insert this row in Table_A how i can get auto-incremented value and save it Table_B.&lt;/P&gt; 
&lt;P&gt;2] Is there any feature/components available using which we can compare source data to destination data and decide if it is new data to be inserted or existing data which we need to update...&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 15:56:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311887#M82888</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-31T15:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve autoincremented primary key Id for each inserted row and use it in second table</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311888#M82889</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;1) I'm afraid you have to query the table to get the id for the new rows&lt;/P&gt;
&lt;P&gt;2) Check for "Insert or update" (or "Update or insert") option of tPostgresqlOutput component&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 16:07:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311888#M82889</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2017-10-31T16:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve autoincremented primary key Id for each inserted row and use it in second table</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311889#M82890</link>
      <description>&lt;P&gt;Thanks for suggestion but according to what you suggestes for #1 my concern is that i will be able to get those IDs after saving all the records but I would like to get that for each record and I see in talend using&amp;nbsp;&lt;SPAN&gt;tPostgresqlOutput&amp;nbsp; it insert records in bulk like 10k at a time un til then nothing is saved so how we can save one row at a time and get ID in return.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 16:14:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311889#M82890</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-31T16:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve autoincremented primary key Id for each inserted row and use it in second table</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311890#M82891</link>
      <description>&lt;P&gt;You can only retrieve the fields which are in the schema but the autoincrement cannot be part of the flow (using a standard SQL query, you cannot mention serial column in Insert/Update statement).&lt;/P&gt; 
&lt;P&gt;You may reduce the "Commit every" parameter to 1 then query for the id row by row but it this will dramadically reduce job throughput (not a good idea).&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 16:33:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311890#M82891</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2017-10-31T16:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve autoincremented primary key Id for each inserted row and use it in second table</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311891#M82892</link>
      <description>&lt;P&gt;So If I want to take latest ID after each row insert using below query&amp;nbsp; but how i can map this to the column do we need to use tmap&amp;nbsp; if yes how?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;select max(id_store) from store;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 17:46:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311891#M82892</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-31T17:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve autoincremented primary key Id for each inserted row and use it in second table</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311892#M82893</link>
      <description>&lt;P&gt;If the id is declared as a serial (it is, isn't it?), you have a sequence associated to the field.&lt;/P&gt; 
&lt;P&gt;In your case it should be called "store_&lt;SPAN&gt;id_store_seq" (tablename + column name + seq).&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;It will be better to ask for the sequence last used value with the following query:&lt;/SPAN&gt;&lt;/P&gt; 
&lt;PRE&gt;select currval('store_id_store_seq')&lt;/PRE&gt; 
&lt;P&gt;&lt;SPAN&gt;This kind of design could be a solution (sorry, I can't try by myself):&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 701px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LrBz.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/130192i27377A26E05A715C/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LrBz.png" alt="0683p000009LrBz.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;tPostgresqlRow will be called for each row (change the lookup model for this flow in the tMap):&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LrfC.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/151093iB4434015DD5597AE/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LrfC.png" alt="0683p000009LrfC.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;It hope this works but once again, not sure as I can't try.&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;Let us know.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 18:52:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311892#M82893</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2017-10-31T18:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve autoincremented primary key Id for each inserted row and use it in second table</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311893#M82894</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;My primary key column is bigserial and its has sequence which you mentioned..but when I do the suggested approach the store_id is always empty in my second table which is referenced table(refer below screenshot) when i want to save it but in the first table ID is saved properly. Please find below screenshots and query use for sequence.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Query:&amp;nbsp;select nextval('rpcs.rp_store_id_store_seq')&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;screenshots:&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="job_flow.png" style="width: 691px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LrOO.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/133760i298EAF1F625C0DE1/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LrOO.png" alt="0683p000009LrOO.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tmap.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LrNv.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/157663iF740E41BC803893D/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LrNv.png" alt="0683p000009LrNv.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Output table:&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="output.png" style="width: 691px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009Lrgj.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/149340i064F0EDA3EBEE8FB/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009Lrgj.png" alt="0683p000009Lrgj.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 13:53:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311893#M82894</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-02T13:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve autoincremented primary key Id for each inserted row and use it in second table</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311894#M82895</link>
      <description>&lt;P&gt;Is anybody have any solution or some other idea to implement this?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2017 13:56:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311894#M82895</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-03T13:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve autoincremented primary key Id for each inserted row and use it in second table</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311895#M82896</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Instead of using tpostgresqlrow I used regular tpostgresqlinput with below query and it worked. If somebody would like to use it in future i am just adding screenshot of job for their reference..&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;select last_value from schemaname.sequencename (here replace your schemaname and sequence name with your)&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="working.png" style="width: 691px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LrGZ.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/140301i5BE5F73FA6430E59/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LrGZ.png" alt="0683p000009LrGZ.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Nov 2017 19:08:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311895#M82896</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-04T19:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve autoincremented primary key Id for each inserted row and use it in second table</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311896#M82897</link>
      <description>Hi,&lt;BR /&gt;You're right tpostgresqlinput is the way to retrieve result from the query.&lt;BR /&gt;Don't forget to mark your case as solved.&lt;BR /&gt;Kudos could be also appreciated for time left and given directions.</description>
      <pubDate>Sat, 04 Nov 2017 20:23:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311896#M82897</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2017-11-04T20:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve autoincremented primary key Id for each inserted row and use it in second table</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311897#M82898</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I start in talend and I work on a practical project.&lt;BR /&gt;I have a problem with inserting all my rows into my table.&lt;BR /&gt;The output of the first tmap returns all the rows, against the output of the second tmap returns single row.&lt;BR /&gt;Could you help me please?&lt;/P&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009LtaP"&gt;5.PNG&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009LtaQ"&gt;6.PNG&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009LtnY"&gt;7.PNG&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009Ltvs"&gt;8.PNG&lt;/A&gt;</description>
      <pubDate>Tue, 30 Oct 2018 11:49:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311897#M82898</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-30T11:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve autoincremented primary key Id for each inserted row and use it in second table</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311898#M82899</link>
      <description>&lt;P&gt;Thanks after read your valuable inputs I have get the PK from table.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 13:17:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311898#M82899</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-02T13:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve autoincremented primary key Id for each inserted row and use it in second table</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311899#M82900</link>
      <description>&lt;P&gt;Thanks, It's useful for me. &lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;--&lt;/P&gt; 
&lt;P&gt;Ashok Parmar&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 13:18:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Retrieve-autoincremented-primary-key-Id-for-each-inserted-row/m-p/2311899#M82900</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-02T13:18:58Z</dc:date>
    </item>
  </channel>
</rss>

