Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Table Input Step Does not replace variables

  1. #1
    Join Date
    Feb 2015
    Posts
    22

    Default Table Input Step Does not replace variables

    0 down vote favorite I'm running the following code in the Input Step of Pentaho Kettle:
    Code:
    SELECT * FROM ${TABELA} WHERE TS_SAMPLETM BETWEEN TO_DATE('${HOJE}', 'DD/MM/YYYY') AND TO_DATE('${SEMANAPASSADA}','DD/MM/YYYY')
    However, when I run the Job via this shell script:
    Code:
    #!/bin/sh
    cd /home/rafael/data-integration/
    export HOJE=$(date +"%d/%m/%Y")
    export SEMANAPASSADA=$(date -d "7 days ago" +"%d/%m/%Y")
    export tabela=tabela1
    
    
    sh kitchen.sh -file=/home/rafael/data-integration/Job_Oracle_MySql.kjb -param:TABELA=$TABELA -param:HOJE=$HOJE -param:SEMANAPASSADA=$SEMANAPASSADA
    The Table Input step does not replace the variables, even with Replace Variables checked.

    Thanks!

  2. #2
    Join Date
    Apr 2008
    Posts
    1,771

    Default

    I think you need to use parameters within a SQL query, not variables
    -- Mick --

  3. #3
    Join Date
    Aug 2011
    Posts
    360

    Default

    Quote Originally Posted by rafaelcampos View Post
    0 down vote favorite I'm running the following code in the Input Step of Pentaho Kettle:
    Code:
    SELECT * FROM ${TABELA} WHERE TS_SAMPLETM BETWEEN TO_DATE('${HOJE}', 'DD/MM/YYYY') AND TO_DATE('${SEMANAPASSADA}','DD/MM/YYYY')
    However, when I run the Job via this shell script:
    Code:
    #!/bin/sh
    cd /home/rafael/data-integration/
    export HOJE=$(date +"%d/%m/%Y")
    export SEMANAPASSADA=$(date -d "7 days ago" +"%d/%m/%Y")
    export tabela=tabela1
    
    
    sh kitchen.sh -file=/home/rafael/data-integration/Job_Oracle_MySql.kjb -param:TABELA=$TABELA -param:HOJE=$HOJE -param:SEMANAPASSADA=$SEMANAPASSADA
    The Table Input step does not replace the variables, even with Replace Variables checked.

    Thanks!
    Hi,

    If you use Kettle named parameters with -param: you have to define these parameters in the properties of your job (job properties > parameters tab).
    Or you can use -Dmyvariable=myvalue instead of -param:..... such that it sets java snvironnement variable, wich would be accessible
    in the job as regular variable.

    I recommand to use named parameters for everything except stuff thst are realy environnement dependent (like the home variable, or a path to a location on network etc.)
    Then you better set environnement variables in the kettle.properties

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.