Pentaho Data Integration – Getting Started With Transformations

Reading Time: 5 minutes

Pentaho Data Integration (PDI) is an extract, transform, and load (ETL) solution that uses an innovative metadata-driven approach.

PDI includes the DI Server, a design tool, three utilities, and several plugins.

You can download the Pentaho from URL:- https://sourceforge.net/projects/pentaho/

Uses of Pentaho Data Integration

Pentaho Data Integration is an extremely flexible tool that addresses a broad number of use cases including:

  • Data warehouse population with built-in support for slowly changing dimensions and surrogate key creation
  • Data migration between different databases and applications
  • Loading huge data sets into databases taking full advantage of cloud, clustered, and massively parallel processing environments
  • Data Cleansing with steps ranging from very simple to very complex transformations
  • Data Integration including the ability to leverage real-time ETL as a data source for Pentaho Reporting
  • Rapid prototyping of ROLAP schemas
  • Hadoop functions: Hadoop job execution and scheduling, simple Hadoop MapReduce design, Amazon EMR integration

Transformations

transformation is a network of logical tasks called steps. Transformations are essentially data flows. In the example below, the database developer has created a transformation that reads a flat file, filters it, sorts it, and loads it to a relational database table.


The two main components associated with transformations are steps and hops:

Streps

Steps are the building blocks of a transformation, for example a text file input or a table output. There are over 140 steps available in Pentaho Data Integration and they are grouped according to function; for example, input, output, scripting, and so on. Each step in a transformation is designed to perform a specific task, such as reading data from a flat file, filtering rows, and logging to a database as shown in the example above. Steps can be configured to perform the tasks you require.

Hops

Hops are data pathways that connect steps together and allow schema metadata to pass from one step to another. In the image above, it seems like there is a sequential execution occurring; however, that is not true. Hops determine the flow of data through the steps not necessarily the sequence in which they run. When you run a transformation, each step starts up in its own thread and pushes and passes data.

Create Transformations

Follow these instructions to begin creating your transformation.

  1. Click File > New > Transformation.
  2. Under the Design tab, expand the Input node, then select and drag a Generate Rows step onto the canvas.Note: If you don’t know where to find a step, there is a search function in the left corner of Spoon. Type the name of the step in the search box. Possible matches appear under their associated nodes. Clear your search criteria when you are done searching.
  3. Expand the Flow node; click and drag a Dummy (do nothing) step onto the canvas.
  4. To connect the steps to each other, you must add a hop. Hops describe the flow of data between steps in your transformation. To create the hop, click the Generate Rows step, then press and hold the <SHIFT> key and draw a line to the Dummy (do nothing) step. Note: Alternatively, you can draw hops by hovering over a step until the hover menu appears. Drag the hop painter icon from the source step to your target step.
  5. Double click the Generate Rows step to open its edit properties dialog box.
  6. In the Limit field, type 100000. This limits the number of generated rows to 100,000.
  7. Under Name, type FirstCol in the Name field.
  8. Then Type, type String.
  9. Under Length, type 150.
  10. Under Value, type My First Step. Your entries should look like the image below. Click OK to exit the Generate Rows edit properties dialog box. 
  11. Now, save your transformation.

Save Your Transformation

  1. In Spoon, click File > Save As. The Transformation Properties dialog box appears.
  2. In the Transformation Name field, type First Transformation.
  3. In the Directory field, click the Folder Icon to select a repository folder where you will save your transformation.
  4. Expand the Home directory and double-click the admin folder. Your transformation will be saved in the admin folder in the DI Repository.
  5. Click OK to exit the Transformation Properties dialog box. The Enter Comment dialog box appears.
  6. Click in the Enter Comment dialog box and press <Delete> to remove the default text string. Type a meaningful comment about your transformation. The comment and your transformation are tracked for version control purposes in the DI Repository.
  7. Click OK to exit the Enter Comment dialog box and save your transformation.

Run Your Transformation Locally

  1. In Spoon, go to File > Open. The contents of the repository appear.
  2. Navigate to the folder that contains your transformation. If you are a user with administrative rights, you may see the folders of other users.
  3. Double-click on your transformation to open it in the Spoon workspace.Note: If you followed the exercise instructions, the name of the transformation is First Transformation.
  4. In the upper left corner of the workspace, click Run. The Execute a Transformation dialog box appears. Notice that Local Execution is enabled by default.
  5. Click Launch. The Execution Results appear in the lower pane.
  6. Examine the contents under Step Metrics.

Build a Job

  1. In the Spoon menubar, go to File > New > Job. Alternatively click  (New) in the toolbar.
  2. Click the Design tab. The nodes that contain job entries appear.
  3. Expand the General node and select the Start job entry.
  4. Drag the Start job entry to the workspace (canvas) on the right.The Start job entry defines where the execution will begin.
  5. Expand the General node, select and drag a Transformation job entry on to the workspace.
  6. Use a hop to connect the Start job entry to the Transformation job entry.
  7. Double-click on the Transformation job entry to open its properties dialog box.
  8. Under Transformation specification, click Specify by name and directory.
  9. Click  (Browse) to locate your transformation in the solution repository.
  10. In the Select repository object view, expand the directories. Locate First Transformation and click OK. The name of the transformation and its location appear next to the Specify by name and directory option.
  11. Under Transformation specification, click OK.
  12. Save your job; call it First Job. Steps used to save a job are nearly identical to saving a transformation.
  13.  Execute a Job dialog box appears,
  14. choose Local Execution and click Launch.The Execution Results panel opens displaying the job metrics and log information for the job execution.

Executing Transformations

When you are done modifying a transformation or job, you can run it by clicking ../pdi_admin_guide/images/run.png (Run) from the main menu toolbar, or by pressing F9. There are three options that allow you to decide where you want your transformation to be executed:

  • Local Execution — The transformation or job executes on the machine you are currently using.
  • Execute remotely — Allows you to specify a remote server where you want the execution to take place. This feature requires that you have the Data Integration Server running or Data Integration installed on a remote machine and running the Carte service. To use remote execution you first must set up a slave server .
  • Execute clustered — Allows you to execute a transformation in a clustered environment.

Conclusion

In this blog we have learnt about Transformations, how can we create ,save and execute the Transformation

For more info you can click here

Written by 

Chiranjeev kumar is a Software intern at Knoldus. He is passionate about the java programming . He is recognized as a good team player, a dedicated and responsible professional, and a technology enthusiast. He is a quick learner & curious to learn new technologies. His hobbies include listening music , playing video games.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading