Insert/Update using Join Snap

Hi,

I am using Join Snap, to implement the logic of Insert new record and update existing one by doing join on target table. i defined left outer join to read all input records and in router i used condition on input1_column1, the condition is working for existing records and it not working for new records. Please can some one can help me how to implement Insert/Update logic using Join snap.

image

Based on what you are trying to accomplish, I suggest taking a look at our Diff snap. You can see a screenshot of the snap below. The two inputs are labeled to help clarify that the lower input is for the original and the outputs are also labeled so you can build separate streams for handling the possible outcomes. If you have a specific reason for trying to build the logic yourself with Join and Router, please let us know.

Hi,

Thanks for the information. Two thing I want to ask you for advice.

  1. I went through Diff Snap, can I know whether it will use any key column to compare between two files?
  2. this is regarding Join Snap, what is the use of Left Outer Join? if i cant differentiate new and old records? the inner join will give only matched records, the left outer join has to give both matched and new recrods right? then it will be easy to do insert/update.

Thanks in advance.

Anil

Hello Anil,

The Diff snap looks at the entire record for comparison, not a single key. The documentation linked in the previous reply has sample pipelines to download then import, which can help you understand how the snap will function.

Regarding your second question, left outer join will take all the data from input0 and input1 that did not match. Our Join snap documentation has an example of what a data stream looks like for each join type.

Hi,

Thanks. My requirement is to work on single Key column. here in my case i am using WRxx as key column. so i thought of using Join snap with left outer join. I got your info on this join type, that is the my idea too. when i use left outer join, i will get all records from Input0 and matched records from Input1 and for unmatched records it should retrun null as out put and i thought of using Null records as New records and matched records as update records. so, if u have any job on join snap, please advice.

Thanks in advance.

hi Pranil,
you can definitely use the join snap for this, route the nulls to one flow(insertions) and matched output(update) to other route. You can also use inner join and use option in join snap ‘unmatched data to error view’, that way the error view records would be considered for insert and the output view of join can be used for updated records.

Regards
Anubhav

Hi Anubhav,

Thaks for the reply. As said by you, i tried to implement the same, but by using left outer join, i am not able to capture null values, this is the first thing i asked, you can see my first screen shot. if it is new value i am not getting any value for Input1 and the job is throwing error.

routing error records using inner join, i did this one using join snap and lookup snap too (using lookup also we can route the error records as new ones and can use them for insert).

so just for information, is it possible to capture null recors using left outer join in Join Snap?

hi, I am able to get nulls for unmatched data, please refer to screenshot below
Input1:

Input 2: image

Join result:

Hi Anubhav,

Thanks for sample. it is very helpful and i will check my job.

Thanks a lot.

Anil