Delta derivation

Hi
I am trying to derive delta in my incoming data in to my AWS Redshift cluster. My requirement is to identify rows that are new / changed and insert current_flag = 1, valid_from = today and valid_to =9999/12/31. While doing this for updates, I expire the current record to have current_flag = 0 and valid_to= today before inserting the latest incoming record.
Could you advise how can i make use of EasyMorph for this Upsert/ Merge ?

To verify if the incoming data already exists, use the “Select matching database rows” action with the key field.

After that, split your incoming dataset into two parts: new data and changed data. Use the “Export to database” action to insert new data, and the “Update database” action to update data in Redshift.