Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Synchronize two tables, and add a timestamp only when certain columns are updated

  1. #1

    Default Synchronize two tables, and add a timestamp only when certain columns are updated

    Hi,
    I need to keep a SRC table synchronized with a DST table.
    I prepared a simple transformation that reads the source table, and that does a Insert / Update on the destination table, and it is working fine.

    But I also need to add two timestamps on the DST table:


    • timestamp1 that reflects the datetime of when that row has been inserted or updated;
    • timestamp2 that reflects the datetime of when certain fields have been updated.


    e.g.
    If any field in the source table changes, I need to update those fields in the destination table, and I need to update timestamp1.
    But I want to update timestamp2 only if col1 or col2 have been updated. If there's a change only on non_important_column, I need to update that field and also timestamp1, but not timestamp2.

    I'm currently using some triggers on the DST table to achieve my result, and they are working, but I'd prefer to keep all the logic inside the trasformation.
    Is there a native way of doing this in kettle?

    Thanks

  2. #2
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    You should leave timestamp1 to the trigger, since there is no business logic involved.
    I would prefer even timestamp2 to be maintained by a trigger, but you can use a Diff step to detect changes if you need to.
    So long, and thanks for all the fish.

  3. #3

    Default

    Thank you Marabu for your quick answer!
    I'll have a look at the Diff step, I will surely need it, but at the moment I'll stay with the triggers... I'm a novice user and I wanted to be sure that my approach wasn't wrong...

    Thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.