Time for action—calling the hello world transformation with fixed arguments and parameters

This time you will call the parameterized transformation from a new job.

  1. Open the hello_world.kjb job you created in the first section and save it as hello_world_fixedvalues.kjb.
  2. Double-click the Create a folder job entry.
  3. Replace the chapter10 string by the string fixedfolder.
  4. Double-click the transformation job entry.
  5. Change the Transformation filename as ${Internal.Job.Filename.Directory}/transformations/hello_world_param.ktr.
  6. Fill the Argument tab as follows.
    Time for action—calling the hello world transformation with fixed arguments and parameters
  7. Click the Parameters tab and fill it as follows:
    Time for action—calling the hello world transformation with fixed arguments and parameters
  8. Click on OK.
  9. Save the job.
  10. Open a terminal window and go to the directory where Kettle is installed.
    • On Windows systems type:
      C:pdi-ce>kitchen /file:c:/pdi_labs/ hello_world_param.kjb /norep
      
    • On Unix, Linux, and other Unix-like systems type:
      /home/yourself/pdi-ce/kitchen.sh /file:/home/yourself/ pdi_labs/hello_world_param.kjb /norep
      
  11. When the execution finishes, check the output folder. A folder named fixedfolder has been created.
  12. In that folder, you can see a hello.txt with the following content:
    Hello, reader!
    

What just happened?

You reused the transformation that expects an argument and a named parameter from the command line. This time you created a job that called the transformation and set both the parameter and the argument in the transformation job entry setting window.

Then you ran the job from a terminal window, without typing any arguments or parameters. It didn't make any difference for the transformation. Whether you provide parameters and arguments from the command line or you set constant values in a transformation job entry, the transformation does its job—creating a file with a custom message in the folder with the name given by the ${HELLOFOLDER}parameter.

Tip

Instead of running from the terminal window, you could have run the job by pressing F9 and then clicking Launch, without typing anything in either the parameter or the argument grid. The final result should be exactly the same.

Have a go hero—saying hello again and again

Modify the hello_world_param.kjb job so that it generates three files in the default ${HELLOFOLDER}, each saying "hello" to a different person.

Tip

After the creation of the folder, use three transformation job entries. Provide different arguments for each.

Run the job to see that it works as expected.

Have a go hero—loading the time dimension from a job

In Chapter 6, you built a transformation that created the data for a time dimension. Then in Chapter 8, you finished the transformation loading the data into a time dimension table.

The transformation had several named parameters, one of them being START_DATE. Create a job that loads a time dimension with dates starting at 01/01/2000. In technical jargon, create a job that calls your transformation and passes it a value for the START_DATE parameter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.44.229