0
votes

There is a case in my ETL where i am trying to take "table output" name from command line. The table name does not correspond to any streaming field's name. Is there any way to get it done in pentaho kettle?

2
are you basing it in from .bat or .sh? What is the error? - Abercrombieande
@Abercrombieande: .sh I want to take table output name as a command line parameter - user3252809

2 Answers

1
votes

Pentaho DI is a metadata based tool. I assume you will be trying to pass the output table name from the command line like below:

.../pan.sh -file:"/home/user/sample.ktr" -param:table_output=SOMETABLE

Assuming the command above is what you are trying.

So firstly, change the transformation settings of sample.ktr (just an example) and add the parameter name : "table_output" to the Parameters section.

Next, in the Table Output Step, use this parameter name in the format : ${table_output} in place of table name. This should solve your query.


Incase you are passing the parameters to a job. As mentioned above, the first section of the adding the parameters remains the same.

You can next take a separate transformation (.ktr) file inside a job, double click on the ktr (from the job file) and you will find PARAMETERS Section like the image below. Add the parameters

enter image description here

Thirdly inside the .ktr file, repeat the step from above (first section) and use a SET VARIABLE or TABLE OUTPUT. SET Variable step will ensure that you have the parameter available across the entire job. Mostly depends on your requirement.

Hope it helps :)

1
votes

This should give you an idea how to do it. Since transformations are just xml you can read the metadata from them. Basically you find the table output step and set it as a variable in this case "TABLE"

TransformationRead the transformation fileenter image description hereenter image description hereOnly keep the step we are interested inSet the table name to a varaible