Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: parameters / Variables

  1. #1
    Join Date
    Jun 2009
    Posts
    7

    Red face parameters / Variables

    I'm new to Kettle so I appologies if I'm asking the obvious.

    When I use a "Table input" step I can use variables like ${startdate} in the sql statement.

    But is it correct that when I use the "insert / update" step I can't use a variable as table field name. So depending on the variable I want to update a different field. First field month01 and in another instance month02 and so on...
    This variable value comes from the job and is passed as a parameter to the transformation. Looks like a logical way of working but I'm new to this.

    I also tried something different. I tried, with the step "Add constants", to add a column to the stream with a variable as the value. This doens't work either. I know that the step is called "Add constants" but anyhow.

    I think that I don't understand the concept of the tool and that I'm thinking to much as a developer.

    Thanks for your help.

  2. #2
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    Usually things like field names are constant in a data integration exercise.
    The transformations need to be somewhat deterministic.

    However, you could still do what you want with an "Exec SQL" step. Dynamic SQL is what it was created for I guess this is one of the rare cases I would in fact recommend you using it

    So I guess it would be something like:

    Code:
    UPDATE foo SET ? = '?'
    ;
    The 2 parameters to set are the column name and the value.
    Typically this is not possible with SQL but we translate this into:

    Code:
    UPDATE foo SET column1 = 'bar'
    ;
    The cost is poor performance but you can't go around that because of database limitations.

    Matt

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.