As a Kettle supplier, I often encounter customers who are struggling with merging two data sources. Merging data is a common requirement in data integration, and Kettle, also known as Pentaho Data Integration (PDI), is a powerful tool that can handle this task efficiently. In this blog post, I’ll walk you through the process of merging two data sources in Kettle, step by step. Kettle

Understanding the Basics of Data Merging
Before we dive into the practical steps, it’s important to understand what data merging is and why it’s necessary. Data merging involves combining data from two or more sources into a single dataset. This can be useful for various reasons, such as consolidating customer information from different databases, integrating sales data from multiple regions, or combining historical and real – time data.
In Kettle, data merging typically involves using transformation steps to combine data based on common fields. There are several ways to merge data, including inner joins, outer joins, and unions. Each method has its own use cases, and the choice depends on the nature of your data and the requirements of your project.
Preparing Your Data Sources
The first step in merging two data sources in Kettle is to prepare your data sources. You need to ensure that the data is in a format that can be easily read by Kettle. This may involve cleaning the data, removing duplicates, and standardizing the data types.
- Identify the Data Sources: Determine the two data sources you want to merge. They could be databases (e.g., MySQL, Oracle), flat files (e.g., CSV, Excel), or other data repositories.
- Understand the Data Structure: Examine the structure of each data source, including the column names, data types, and relationships between columns. This will help you determine how to merge the data.
- Clean the Data: Use data cleaning techniques to remove any invalid or inconsistent data. This may involve handling missing values, correcting data types, and removing duplicate records.
Creating a New Kettle Transformation
Once your data sources are prepared, you can start creating a new Kettle transformation.
- Open Kettle: Launch the Kettle Spoon application. If you’re new to Kettle, Spoon is the graphical user interface (GUI) that allows you to design and execute data integration processes.
- Create a New Transformation: Go to the "File" menu and select "New" > "Transformation". This will open a new transformation canvas where you can start adding steps.
Adding Input Steps for Data Sources
The next step is to add input steps for your two data sources.
- Add a Table Input Step: If your data source is a database, you can use the "Table Input" step. Drag and drop the "Table Input" step from the "Input" category onto the transformation canvas. Double – click on the step to configure it. You’ll need to specify the database connection, the table name, and the SQL query to retrieve the data.
- Add a Text File Input Step: If your data source is a flat file, you can use the "Text File Input" step. Drag and drop the "Text File Input" step from the "Input" category onto the transformation canvas. Double – click on the step to configure it. You’ll need to specify the file path, the file format (e.g., CSV, fixed – width), and the column delimiter.
Merging the Data
There are several ways to merge the data in Kettle. Here are some common methods:
Inner Join
An inner join returns only the rows where there is a match in both data sources.
- Add a Join Step: Drag and drop the "Join" step from the "Transform" category onto the transformation canvas. Connect the output of the two input steps to the "Join" step.
- Configure the Join Step: Double – click on the "Join" step to configure it. Select the type of join (in this case, "Inner Join"). Specify the key fields from each data source that will be used to match the rows.
- Execute the Transformation: Once the join step is configured, you can run the transformation to see the merged data.
Outer Join
An outer join returns all the rows from one data source and the matching rows from the other data source. There are three types of outer joins: left outer join, right outer join, and full outer join.
- Add a Join Step: Similar to the inner join, drag and drop the "Join" step onto the transformation canvas and connect the input steps.
- Configure the Join Step: Double – click on the "Join" step and select the appropriate outer join type (e.g., "Left Outer Join"). Specify the key fields for matching.
- Execute the Transformation: Run the transformation to view the merged data.
Union
A union combines the rows from two data sources without considering any matching conditions. The columns in both data sources must have the same data types and order.
- Add a Union Step: Drag and drop the "Union" step from the "Transform" category onto the transformation canvas. Connect the output of the two input steps to the "Union" step.
- Execute the Transformation: Run the transformation to see the combined data.
Handling Data Conflicts
When merging data, you may encounter conflicts, such as duplicate records or inconsistent data values. Here are some ways to handle these conflicts:
- Deduplication: Use the "Deduplicate" step in Kettle to remove duplicate records. You can specify the key fields based on which the duplicates will be identified.
- Data Validation: Add data validation steps to ensure that the merged data meets your quality standards. For example, you can use the "Value Mapper" step to standardize data values.
- Error Handling: Implement error handling mechanisms in your transformation to handle any data errors gracefully. You can use the "Error Handling" tab in each step to specify how errors should be handled.
Outputting the Merged Data
Once the data is merged, you need to output the result to a destination.
- Add an Output Step: Depending on your requirements, you can add an output step such as "Table Output" (if you want to write the data to a database table) or "Text File Output" (if you want to save the data as a flat file).
- Configure the Output Step: Double – click on the output step to configure it. Specify the destination database connection or file path, and map the fields from the merged data to the columns in the destination.
- Execute the Transformation: Run the transformation to write the merged data to the destination.
Testing and Optimization
After creating the transformation, it’s important to test it thoroughly to ensure that the data is merged correctly. You can use the "Preview" feature in Kettle to view a sample of the data at each step of the transformation.
If the transformation is slow, you can optimize it by:
- Indexing: If you’re working with databases, make sure that the key fields used for joining are indexed. This can significantly improve the performance of the join operation.
- Partitioning: If the data is large, consider partitioning the data to reduce the amount of data processed at each step.
- Parallel Processing: Kettle supports parallel processing, which can speed up the transformation. You can configure the parallelism settings in the transformation properties.
Conclusion
Merging two data sources in Kettle is a powerful way to integrate data from different sources. By following the steps outlined in this blog post, you can create a robust data integration process that meets your business needs.

As a Kettle supplier, we offer comprehensive support and services to help you with your data integration projects. Whether you’re a beginner or an experienced user, our team of experts can assist you in designing, implementing, and optimizing your Kettle transformations.
Hand Blender If you’re interested in learning more about how Kettle can benefit your organization or if you’re ready to start a data integration project, we encourage you to reach out to us for a procurement discussion. We’ll be happy to provide you with more information, answer your questions, and discuss how we can tailor our solutions to your specific requirements.
References
- Pentaho Data Integration (PDI) User Guide
- Data Integration Best Practices by Informatica
- SQL for Data Analysis by Mode Analytics
Ningbo Lanka International Trading Co., Ltd.
As one of the most professional kettle manufacturers and suppliers in China, we’re featured by quality products and low price. Please rest assured to wholesale high-grade kettle for sale here from our factory. Also, custom service is available.
Address: No.11 Dongqian Lake Area, Yinxian Avenue, Ningbo, China
E-mail: messi@lanka10.com
WebSite: https://www.lanka-10.com/