<?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: Insert or update on duplicate key but not update all fields in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2284996#M58618</link>
    <description>Let?s move on a little further with the point. 
&lt;BR /&gt;In my case there are two fields to be updated on duplicate key (unique key column name - `code`) - `name`, `date_modified`. On initial insert `date_modified` is equal to `date_created`. And I would like to modify `date_modified` only in case if `name` value is really modified. Every time the job is executed `date_modified` column should remain unchanged if value of the `name` column is the same as before updating. 
&lt;BR /&gt;It looks like database BEFORE UPDATE trigger could help. But I don?t want to split business logic between TOS and database. Moreover in my project this procedure should be re-used against many other database tables. So creating trigger for each table won?t be elegant solution. 
&lt;BR /&gt;Any ideas which component (or its options) can help?</description>
    <pubDate>Fri, 22 Mar 2013 19:22:35 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2013-03-22T19:22:35Z</dc:date>
    <item>
      <title>Insert or update on duplicate key but not update all fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2284992#M58614</link>
      <description>I am trying to load data into a dimension table. It is straight forward enough, if the record does not exist, created it. If the record does exist update it. Setting "Action on data" to "Insert or update on duplicate key or unique index" in my tMysqlOutput step does basically what I am looking for. However, when updating, I do not want to update all fields. There are couple that I want to keep as the current value while updating all the other fields. It is not clear to me how I can set the action at the individual field level. Any help would be greatly appreciated. 
&lt;BR /&gt;Thanks, 
&lt;BR /&gt;Jason</description>
      <pubDate>Thu, 26 Jul 2012 20:13:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2284992#M58614</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-26T20:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: Insert or update on duplicate key but not update all fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2284993#M58615</link>
      <description>You can do it using repective database level SCD compoent (example: tOracleSCD). What you are trying to achieve is combining type 1 and type 0 SCD .
&lt;BR /&gt;You can find the help in TalendIntegrationSuite_Components document and look for tMySQLSCD component.</description>
      <pubDate>Thu, 26 Jul 2012 21:37:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2284993#M58615</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-26T21:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: Insert or update on duplicate key but not update all fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2284994#M58616</link>
      <description>Just exclude the fields you don't want updated from the schema of tMysqlOutput or use the "Field options" in the Advanced Settings.</description>
      <pubDate>Fri, 27 Jul 2012 03:51:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2284994#M58616</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2012-07-27T03:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: Insert or update on duplicate key but not update all fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2284995#M58617</link>
      <description>alevy, this was exactly what I was looking for. Thanks for helping out this newbie.</description>
      <pubDate>Fri, 27 Jul 2012 09:06:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2284995#M58617</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-27T09:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: Insert or update on duplicate key but not update all fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2284996#M58618</link>
      <description>Let?s move on a little further with the point. 
&lt;BR /&gt;In my case there are two fields to be updated on duplicate key (unique key column name - `code`) - `name`, `date_modified`. On initial insert `date_modified` is equal to `date_created`. And I would like to modify `date_modified` only in case if `name` value is really modified. Every time the job is executed `date_modified` column should remain unchanged if value of the `name` column is the same as before updating. 
&lt;BR /&gt;It looks like database BEFORE UPDATE trigger could help. But I don?t want to split business logic between TOS and database. Moreover in my project this procedure should be re-used against many other database tables. So creating trigger for each table won?t be elegant solution. 
&lt;BR /&gt;Any ideas which component (or its options) can help?</description>
      <pubDate>Fri, 22 Mar 2013 19:22:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2284996#M58618</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-03-22T19:22:35Z</dc:date>
    </item>
    <item>
      <title>Re: Insert or update on duplicate key but not update all fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2284997#M58619</link>
      <description>I don't believe there is a "nice" way to do this. You have only one option I can see: first read the data from the table to compare with your "new" data in tMap and send only the records with changed 'name' values to the DB. 
&lt;BR /&gt;It might also be possible to use a tJavaFlex to introduce additional conditions into the prepared statements that Talend creates but this would be tricky and very much non-standard 
&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;.</description>
      <pubDate>Wed, 03 Apr 2013 03:07:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2284997#M58619</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2013-04-03T03:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: Insert or update on duplicate key but not update all fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2284998#M58620</link>
      <description>Another thought: perhaps you could use a tRow component with your own PreparedStatement instead of tOutput.</description>
      <pubDate>Mon, 08 Apr 2013 02:36:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2284998#M58620</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2013-04-08T02:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: Insert or update on duplicate key but not update all fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2284999#M58621</link>
      <description>Thank you, alevy, for your answers! 
&lt;BR /&gt;Since posted my question I played a little with different approaches. Usage of tRow component is described in this book 
&lt;A href="http://www.packtpub.com/getting-started-with-talend-open-studio-for-data-integration/book" rel="nofollow noopener noreferrer"&gt;http://www.packtpub.com/getting-started-with-talend-open-studio-for-data-integration/book&lt;/A&gt; . I think finally I will choose this approach as it lets operate with simple customizable SQL query. 
&lt;BR /&gt;But before I tried to find a solution within tMap component. I used filters in output checking equality between "new" and "old" values. While filters itself solves the problem perfectly I can't manage updating tables: neither different options of "Action on data", nor "Use field options? in ?Advanced Settings? of tMysqlOutput component let me to update values. I tried to debug result SQL queries with tJavaRow component but unfortunately it returns only null values for statement like System.out.println(((String)globalMap.get("tMysqlOutput_1_QUERY")));</description>
      <pubDate>Mon, 08 Apr 2013 06:48:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2284999#M58621</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-08T06:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: Insert or update on duplicate key but not update all fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2285000#M58622</link>
      <description>No, tMysqlOutput_1_QUERY is never populated. What problem are you having with updating the table?</description>
      <pubDate>Mon, 08 Apr 2013 07:01:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2285000#M58622</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2013-04-08T07:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: Insert or update on duplicate key but not update all fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2285001#M58623</link>
      <description>Thanks again, alevy, for your interest to my case and helping me. 
&lt;BR /&gt;Here are some screenshots I made for the job explanation. As you can see tMap filters work as it should be. But as the job finishes the `regions` table is not updated with new value of `name` field. That?s the main problem. 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;A href="http://www.flickr.com/photos/erop888/8630142979/" target="_blank" rel="nofollow noopener noreferrer"&gt;&lt;IMG src="https://community.qlik.com/" /&gt;&lt;/A&gt; 
&lt;BR /&gt; 
&lt;A href="http://www.flickr.com/photos/erop888/8630142979/" target="_blank" rel="nofollow noopener noreferrer"&gt;The_Job&lt;/A&gt; 
&lt;BR /&gt; 
&lt;A href="http://www.flickr.com/photos/erop888/8631250436/" target="_blank" rel="nofollow noopener noreferrer"&gt;&lt;IMG src="https://community.qlik.com/" /&gt;&lt;/A&gt; 
&lt;BR /&gt; 
&lt;A href="http://www.flickr.com/photos/erop888/8631250436/" target="_blank" rel="nofollow noopener noreferrer"&gt;tMap_Editor&lt;/A&gt; 
&lt;BR /&gt; 
&lt;A href="http://www.flickr.com/photos/erop888/8630142899/" target="_blank" rel="nofollow noopener noreferrer"&gt;&lt;IMG src="https://community.qlik.com/" /&gt;&lt;/A&gt; 
&lt;BR /&gt; 
&lt;A href="http://www.flickr.com/photos/erop888/8630142899/" target="_blank" rel="nofollow noopener noreferrer"&gt;tMysqlOutput_Advanced_Settings&lt;/A&gt; 
&lt;BR /&gt; 
&lt;A href="http://www.flickr.com/photos/erop888/8631250364/" target="_blank" rel="nofollow noopener noreferrer"&gt;&lt;IMG src="https://community.qlik.com/" /&gt;&lt;/A&gt; 
&lt;BR /&gt; 
&lt;A href="http://www.flickr.com/photos/erop888/8631250364/" target="_blank" rel="nofollow noopener noreferrer"&gt;tMysqlOutput_Basic_Settings&lt;/A&gt; 
&lt;BR /&gt; 
&lt;A href="http://www.flickr.com/photos/erop888/8630142847/" target="_blank" rel="nofollow noopener noreferrer"&gt;&lt;IMG src="https://community.qlik.com/" /&gt;&lt;/A&gt; 
&lt;BR /&gt; 
&lt;A href="http://www.flickr.com/photos/erop888/8630142847/" target="_blank" rel="nofollow noopener noreferrer"&gt;tMysqlOutput_Schema&lt;/A&gt; 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MByJ.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/148598iDB7B0919F5D7D793/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MByJ.png" alt="0683p000009MByJ.png" /&gt;&lt;/span&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MByO.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/137068i5CCC1F2FAB4DED75/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MByO.jpg" alt="0683p000009MByO.jpg" /&gt;&lt;/span&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MByY.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/137115i3FEEEEEB4D650EA9/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MByY.png" alt="0683p000009MByY.png" /&gt;&lt;/span&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MByd.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/137589iE3DE2D0DF27B7F8B/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MByd.png" alt="0683p000009MByd.png" /&gt;&lt;/span&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBsc.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/137206i3A170F761798D9C0/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBsc.png" alt="0683p000009MBsc.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Mon, 08 Apr 2013 10:19:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2285001#M58623</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-08T10:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: Insert or update on duplicate key but not update all fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2285002#M58624</link>
      <description>P.S. Sorry, I'm new on inserting images here. Sorry again...
&lt;BR /&gt;P.P.S. BTW, are there any guides how to insert those "beautiful" screenshots right in the messages? I can't manage to find any of these.</description>
      <pubDate>Mon, 08 Apr 2013 10:20:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2285002#M58624</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-08T10:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: Insert or update on duplicate key but not update all fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2285003#M58625</link>
      <description>Hi erop, 
&lt;BR /&gt;If you register and log in as a Community member, you'll get a Image upload box that allows to upload screen captures and images up to 200KB. 
&lt;BR /&gt;For registered users, I realized that the image upload feature is only available when clicking on "post reply" (not through the quick post"). 
&lt;BR /&gt; 
&lt;BR /&gt;Best regards 
&lt;BR /&gt;Sabrina 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBw9.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/153072iA75D68A787476670/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBw9.png" alt="0683p000009MBw9.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Mon, 08 Apr 2013 10:30:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2285003#M58625</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-08T10:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: Insert or update on duplicate key but not update all fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2285004#M58626</link>
      <description>Many thanks, Sabrina! I swear I'll never use "Quick post" option 
&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;</description>
      <pubDate>Mon, 08 Apr 2013 10:36:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2285004#M58626</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-08T10:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: Insert or update on duplicate key but not update all fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2285005#M58627</link>
      <description>You've specified the update key as code_federal but you are not populating that field in the tMap!</description>
      <pubDate>Tue, 09 Apr 2013 00:14:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2285005#M58627</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2013-04-09T00:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: Insert or update on duplicate key but not update all fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2285006#M58628</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;You've specified the update key as code_federal but you are not populating that field in the tMap!&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;Thank you, alevy, so much! As usual for me, the solution was so obvious and simple 
&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;</description>
      <pubDate>Tue, 09 Apr 2013 08:19:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2285006#M58628</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-09T08:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: Insert or update on duplicate key but not update all fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2285007#M58629</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;No, tMysqlOutput_1_QUERY is never populated.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;alevy, have you any ideas about approaches on debugging/logging resulting SQL query in tMysqlOutput component?</description>
      <pubDate>Tue, 09 Apr 2013 12:31:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2285007#M58629</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-09T12:31:28Z</dc:date>
    </item>
    <item>
      <title>Re: Insert or update on duplicate key but not update all fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2285008#M58630</link>
      <description>I've seen the question asked a few times on the forum but I don't think there's a way to do it in Talend since it uses prepared statements.  You would have to look at the DB logs.  Having said that, you can certainly at least see the data you're sending to tMysqlOutput with a tLogRow.</description>
      <pubDate>Wed, 10 Apr 2013 00:08:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2285008#M58630</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2013-04-10T00:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Insert or update on duplicate key but not update all fields</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2285009#M58631</link>
      <description>Thank you, alevy!</description>
      <pubDate>Wed, 10 Apr 2013 07:04:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Insert-or-update-on-duplicate-key-but-not-update-all-fields/m-p/2285009#M58631</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-10T07:04:35Z</dc:date>
    </item>
  </channel>
</rss>

