Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Surrogate key generation in talend

Hi everyone,
I want to load a table from db2 to hive and generate a new surrogate key from Talend
ex. say i have two records in the table CUSTOMER
 CUST_ID name
100    k
200    kk
Target 
S_ID CUST_ID Name
1       100  k
2        200  kk
I am able to achieve this by the using numeric.sequence("S1",1,1) in tmap expression.
However, if i want to load deltas, say this table contains two more records in the future, when i run the talend job again
I want surrogate keys to be 3 and 4 and not 1 and 2 again.
Hope my requirement is clear.
Please help.
Thanks
Labels (2)
3 Replies
Anonymous
Not applicable
Author

You can do this using numeric.sequence, you just need to know what the starting number should be.
You can get this by either counting the rows in the table, or recording the last-used number.
Alternatively, you can externalize your sequence generation using a database, for example.
Anonymous
Not applicable
Author

Thanks for your reply!
Can you please elaborate on thie? How can I record the last used number?
Thanks
Anonymous
Not applicable
Author

 
Hi , For Generating Surrogate key in Talend with last record incremented , refer the above blog