06-13-2024 01:45 AM
Hello Experts,
I have a JSON input looks like this:
[
{
"id": "0000000",
"type": "DUMMY_Payload",
"userId": "ABCD1234"
},
{
"id": "1111111",
"type": "DUMMY_Payload_1",
"userId": "QWER5678"
},
{
"id": "2222222",
"type": "DUMMY_Payload_2",
"userId": "ABCD1234"
}
]
The ask is that I have to bulk upsert these values to Snowflake DB. However, there is one process that are needed to be conducted:
We need to first encrypt userID in custom encryption format like XXXX123, XXXX456 and so on. Any repeating userID will have the same encrypted userID as that of first. Below is an example:
ABCD1234 | XXXX123 |
QWER5678 | XXXX456 |
ABCD1234 | XXXX123 |
Does anyone know how to achieve this via Snaplogic in the most optimized way so that the performance should not hamper?
Thanks in Advance
Solved! Go to Solution.
06-13-2024 06:58 AM
Solution:
I first used group by snap to group userID fields. Next I put a mapper and added a custom encrypted value with expression
'XXXX'+sl.range(4).map(x => "0123456&#X"[Math.round(Math.random()*9)]).join('')
Then I added a JSON splitter to split the group and included value of custom encryption.
06-13-2024 06:58 AM
Solution:
I first used group by snap to group userID fields. Next I put a mapper and added a custom encrypted value with expression
'XXXX'+sl.range(4).map(x => "0123456&#X"[Math.round(Math.random()*9)]).join('')
Then I added a JSON splitter to split the group and included value of custom encryption.