Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: Duplicated value for key

  1. #1

    Default Duplicated value for key

    Hi,
    Every time when i have to run the transformation to update the database i get the error duplicated value for key, so a have to change the value of the add sequence step to the value thet is more then the value of the primary fiel in the table that i have to update data. I dont know how to solve this.

    Someone had the same problem
    please any idea.

    Thank your advice.

  2. #2
    Join Date
    Nov 2008
    Posts
    271

    Default

    Hard to help, without knowing what you are doing in your transformation.
    Anyway, you may want to give a look ar the Dimension lookup/update step. It can handle key generation.
    Andrea Torre
    twitter: @andtorg

    join the community on ##pentaho - a freenode irc channel

  3. #3
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    Why are the keys not generated by the target database in the first place?
    So long, and thanks for all the fish.

  4. #4

    Default

    Quote Originally Posted by Ato View Post
    Hard to help, without knowing what you are doing in your transformation.
    Anyway, you may want to give a look ar the Dimension lookup/update step. It can handle key generation.
    I have in my transformation 4 steps:
    Table input --» Add sequence --» Select values --» Insert/ Update
    Am using the Add sequence to generate de dimension key but every time i have to insert the start value in "start at value". How can i make it automaticaly that i dont have to manualy change the start value, so the transformation id generator starts in last_value_in_database+1.

    Thank your advice.

  5. #5

    Default

    You can use the Target table sequence from the database Name:  seq.jpg
Views: 20
Size:  17.0 KB

  6. #6
    Join Date
    Apr 2008
    Posts
    4,686

    Default

    Break the work into two Transformations:

    T1: Get the Max Value from table, process as needed, and set variable TABLE_MAX
    T2: Get the source data add the sequence (start value = ${TABLE_MAX} ), write to table

    Or you CAN do it in one transformation if you want...
    Table Input 1 (Get Source Data ) -> Add Sequence -> Cartesian Join (Input 1)
    Table Input 2 (Get Destination Max) -> Cartesian Join (Input 2)

    C.Join -> Calculator (ID Value= Destination Max + Sequence Value) -> Table Output

    --
    Oh, and I'll second marabu's comment: Why isn't your DB configured to do this for you?
    **THIS IS A SIGNATURE - IT GETS POSTED ON (ALMOST) EVERY POST**
    I'm no expert.
    Take my comments at your own risk.

    PDI user since PDI 3.1
    PDI on Windows 7 & Linux

    Please keep in mind (and this may not apply to this thread):
    No forum member is going to do your work for you. We will help you sort out how to do a specific part of the work, as best we can, in the timelines that our work will allow us.
    Signature Updated: 2014-06-30

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.