Running transformations with the Pan utility
So far, you have used Spoon to create and run transformations. However, if you want to run a transformation in a production environment, you won't use Spoon, but a command-line utility named Pan
.
Let's quickly look at how to use this tool.
If you browse the PDI installation directory, you will see two versions of the utility: Pan.bat
and Pan.sh
. You will use the first if you have a Windows environment, and the second for other systems.
Note
In the next step-by-step tutorial, we will assume that you have Windows, but you should make the required adjustments if you have a different system.
The simplest way to run a transformation with Pan
is to provide the full path of the transformation that you want to run. You can execute Pan
in Windows as follows:
Pan.bat /file=<ktr file name>
For Unix, Linux, and other Unix-like systems, use the following command:
./Pan.sh /file=<ktr file name>
Let's suppose that you want to run the first transformation created in this chapter, which is located in the following directory:
c:/pdi_labs/my_first_transformation.ktr
In order to run it, follow these instructions:
- Open a Terminal window
- Go to the directory where PDI is installed and type the following code:
Pan /file=c:/pdi_labs/my_first_transformation.ktr
Note
You must include the full path for the transformation file. If the name contains spaces, surround it with double quotes.
After running the command, you will see the log of the execution, which is the same log that you see in the Execution Results
window in Spoon. In order to change the log level
, just add the following:
-level:<log level>
The possible values for the log level are Nothing
, Minimal
, Error
, Basic
, Detailed
, Debug
, and Rowlevel
.
As an example, the following command will print not only the basic log, but also the details of every row that is being processed:
Pan - level:Rowlevel /file=c:/pdi_labs/my_first_transformation.ktr
The details of the rows are as follows:
...
2018/06/10 12:33:43 - Sort rows.0 - Read row: [YONKERS], [NY], [10701]
2018/06/10 12:33:43 - Sort rows.0 - Read row: [YONKERS], [NY], [10703]
2018/06/10 12:33:43 - Sort rows.0 - Read row: [YONKERS], [NY], [10705]
2018/06/10 12:33:43 - Sort rows.0 - Read row: [YORKVILLE], [NY], [13495]
2018/06/10 12:33:43 - Sort rows.0 - Read row: [YULAN], [NY], [12792]
2018/06/10 12:33:43 - Sort rows.0 - Signaling 'output done' to 0 output rowsets.
2018/06/10 12:33:43 - Sort rows.0 - Finished processing (I=0, O=0, R=1146, W=1146, U=0, E=0)
In the last version of our transformation, we added a named parameter with the path where PDI had to look for the input file. In Spoon, you provided the value in the Execution
window. When running the transformation with Pan
, you do it by using the param
option, as follows:
/param:<parameter name>=<parameter value>
In our example, supposing that the new value is c:/samples
, we build the command-line parameter as follows:
/param:"NAME=c:/samples"
Note
If you want to know all of the possible options for the Pan
command, run Pan.bat
or Pan.sh
without parameters, and all of the options will be displayed.