Ask Your Question
1

Need to generate unique keys for a column in the teradata using Streamsets

asked 2019-07-25 07:55:32 -0500

shashikumar65 gravatar image

In the teradata, we have columns where the keys are generated by the source system and it is unique. Presently i have to implement the generation of unique keys in streamsets and that can be sequence of number and it has to be unique and it has to be written to a column in the teradata table. Other columns i will updating it as per the source table.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2019-07-25 13:15:32 -0500

iamontheinet gravatar image

Hi!

You can use uuid:uuid() function to generate unique ID for each record. Refer to the documentation for details on it.

Cheers, Dash

edit flag offensive delete link more
0

answered 2019-07-25 13:19:43 -0500

metadaddy gravatar image

In general, it's better to have the database manage these kind of id columns. Here is an example from StackOverflow of how to define an auto-increment column in Teradata:

SEQ_NUM decimal(10,0) NOT NULL GENERATED ALWAYS AS IDENTITY
           (START WITH 1 
            INCREMENT BY 1 
            MINVALUE 1 
            MAXVALUE 2147483647 
            NO CYCLE)

If you really must have the value generated in Data Collector, Dash's suggestion of a UUID is the best way to go. Generating sequential record id's in the pipeline is tricky and brittle.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-07-25 07:46:25 -0500

Seen: 268 times

Last updated: Jul 25