• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » add new column as primary key

#1 2007-12-13 16:47:27

takata
Guest

add new column as primary key

hello,
I need to add a new column in my schema, it s an ID field, but my problem is that this field must be unique... It identifies an alert for my application...
Can u help me please ???

Regards.

#2 2007-12-14 06:23:25

shong
Talend team
Registered: 2007-08-29
Posts: 10289
Website

Re: add new column as primary key

Hi

What about your generated language?Java or Perl? Can you show more detailed information about your job and what are your expected language?

Best regards

         shong


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#3 2007-12-14 11:19:21

takata
Guest

Re: add new column as primary key

I use TOS 2.2 with java...
My problem is that in my job I make some alerts that I put in a CSV file, but I want add a id column as unique number of alert for log... what I made now is to make a routine that returns an integer :
 
   public class id {
    public static int iden = 0;
                   
    public static int identifiant() {
        iden ++;
        int id = iden;
        return id;
    }
}


is there a better solution ???

#4 2007-12-14 12:12:01

takata
Guest

Re: add new column as primary key

The problem with using the java function is that for each job running the id is set to 0 in the beginning...

#5 2007-12-14 13:53:03

mhirt
Talend team
Registered: 2006-09-19
Posts: 1633

Re: add new column as primary key

Hello,

I have not checked your method, but Talend Open Studio already provides his own sequence generator in a system routine.
Call Numeric.sequence("sequence_name", startvalue, step) in your job.

Regards,

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » add new column as primary key

Board footer

Powered by FluxBB