Reputation: 109
I'm running the following code in the Input Step of Pentaho Kettle:
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:
#!/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.
Upvotes: 0
Views: 1815
Reputation: 6998
Your problem is errors in your shell script, and not errors with Pentaho, or Table Input Step. If you try to insert echo
before the sh
on the last line you can see the command that is run:
echo sh kitchen.sh -file=/home/rafael/data-integration/Job_Oracle_MySql.kjb -param:TABELA=$TABELA -param:HOJE=$HOJE -param:SEMANAPASSADA=$SEMANAPASSADA
For me this outputs:
sh kitchen.sh -file=/home/rafael/data-integration/Job_Oracle_MySql.kjb -param:TABELA= -param:HOJE=18/12/2015 -param:SEMANAPASSADA=
The problems in your shellscript is
$TABELA
with $tablea
export SEMANAPASSADA=$(date -v -7d +"%d/%m/%Y")
After these changes when I run the script it outputs:
sh kitchen.sh -file=/home/rafael/data-integration/Job_Oracle_MySql.kjb -param:TABELA=tabela1 -param:HOJE=18/12/2015 -param:SEMANAPASSADA=11/12/2015
which probably is closer to what you want.
Upvotes: 1