Pranjal Kaushik
Pranjal Kaushik

Reputation: 13

Generated random value (uuid) in Pentaho as Column value?

I have a transformation in Pentaho which looks like this:

enter image description here

This transformation populates a table PRO_T_TICKETS in PostgreSQL. And this table primary key is named OID and has the uuid data type.

Here is a snip of my Database Join query:

enter image description here

I want to use the generated random value by Pentaho as column value for OID.

My question is where should I place the step "Generate random value (OID)" in my Pentaho job flow and what editing should I make in my db join so the join selects this generated uuid as its value?

Upvotes: 0

Views: 3846

Answers (2)

simar
simar

Reputation: 1832

Since you don't use any data to generate uuid then u can just do something

create sequence uuid_sequence_sample;
create table atest(oid uuid default uuid_generate_v5(uuid_ns_url(), cast(nextval('uuid_sequence_sample') as text)), id int, name text);

insert into atest(id, name) values(12, 'hello');

select * from atest;

oid                                  | id | name
-------------------------------------------------
b80c8fef-a677-5340-85fb-2c162d75df03 | 12 | hello

Upvotes: 0

AlainD
AlainD

Reputation: 6356

Get the data flow as you want except it has no OID. Make the flow to cross the Generate random value and name it OID. That should be the flow you are looking for.

Also, be kind for us, clean you example and remove all what is not mandatory to understand the problem (like sort, normalizer and the kind of sort).

Upvotes: 1

Related Questions