0

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.

Sarang Manjrekar
  • 1,839
  • 5
  • 31
  • 61

1 Answers1

1

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

xkavator
  • 376
  • 2
  • 4
  • Yes I did, but then I get same random value corresponding to all the rows, which is not whats desired. – Sarang Manjrekar Aug 05 '17 at 11:43
  • 2
    That's weird. This step supposed to generate a unique id per row. This is exactly what happens if I connect "Table Input" (a select statement) with "Generate random value" step in the transformation flow. Do you have any intermediate steps between? – xkavator Aug 05 '17 at 15:23
  • Got it now, I was using it the wrong way, I was making use of Join rows option. Its working as expected now. – Sarang Manjrekar Aug 05 '17 at 15:52