Search code examples
pentahopentaho-spoonpentaho-data-integration

pentaho PDI passing uservariable in command line


I am trying to run a Transformation/Job by passing a user variable in command line. I have tried by passing variable value as below.

sh pan.sh -file='test.ktr' '-param:input_directory=/path/to/directory' -level=basic where input_directory is variable in transformation and i mentioned it as ${input_directory}

But when I do this, the pan is unable to find the variable value. It is throwing error as below

Could not list the contents of "file:///home/user1/pdi8.1/data-integration8.1/${input_directory}" because it is not a folder.

can someone help me on this. Thank you


Solution

  • To pass named parameters to your job or transformation, the parameters need to be defined in the properties window, shown here for a transformation. The default value is not needed, but works well for testing. Pay attention to capitalization.

    enter image description here

    So the pieces of the puzzle are:

    1. From the command line, pass the parameter like -param:yourparam=yourvalue
    2. Define this same parameter in the highest-level job or transformation
    3. Use it as you would use any variable, with ${yourparam}