Search code examples
pentahokettlepentaho-data-integration

adding a UUID4 ID to each row in Pentaho


I am inserting the result of a SELECT statement from a relational table into another table using Pentaho, is it possible to add a UUID4 identifier to each row and then insert.

Data before insertion :

ip              country city    start_time
1.7411624393E10 Canada  London  2017-06-01 15:27:23
1.7411221531E10 Canada  Ottawa  2017-06-02 23:57:56
1.846525287E9   Canada  Langley 2017-06-02 22:27:29
2.0647254234E10 Canada  Toronto 2017-06-02 22:22:49
2.0647254234E10 Canada  Toronto 2017-06-02 22:22:12
2.0647254234E10 Canada  Toronto 2017-06-02 22:21:20

Needed as :

UUID ip             country city    start_time
ID1  1.7411624393E10    Canada  London  2017-06-01 15:27:23
ID2  1.7411221531E10    Canada  Ottawa  2017-06-02 23:57:56
ID3  1.846525287E9      Canada  Langley 2017-06-02 22:27:29
ID4  2.0647254234E10    Canada  Toronto 2017-06-02 22:22:49
ID5  2.0647254234E10    Canada  Toronto 2017-06-02 22:22:12
ID6  2.0647254234E10    Canada  Toronto 2017-06-02 22:21:20

I am able to generate one UUID4 ID using random generator for all the records, but I need to generate ofcourse separate UUIDs for all the rows.


Solution

  • You can use "Generate random value" step to create a column with a type "Universally Unique Identifier type 4(UUID4)".