Book Image

Pentaho Data Integration Cookbook - Second Edition

Book Image

Pentaho Data Integration Cookbook - Second Edition

Overview of this book

Pentaho Data Integration is the premier open source ETL tool, providing easy, fast, and effective ways to move and transform data. While PDI is relatively easy to pick up, it can take time to learn the best practices so you can design your transformations to process data faster and more efficiently. If you are looking for clear and practical recipes that will advance your skills in Kettle, then this is the book for you. Pentaho Data Integration Cookbook Second Edition guides you through the features of explains the Kettle features in detail and provides easy to follow recipes on file management and databases that can throw a curve ball to even the most experienced developers. Pentaho Data Integration Cookbook Second Edition provides updates to the material covered in the first edition as well as new recipes that show you how to use some of the key features of PDI that have been released since the publication of the first edition. You will learn how to work with various data sources – from relational and NoSQL databases, flat files, XML files, and more. The book will also cover best practices that you can take advantage of immediately within your own solutions, like building reusable code, data quality, and plugins that can add even more functionality. Pentaho Data Integration Cookbook Second Edition will provide you with the recipes that cover the common pitfalls that even seasoned developers can find themselves facing. You will also learn how to use various data sources in Kettle as well as advanced features.
Table of Contents (21 chapters)
Pentaho Data Integration Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
References
Index

Deleting a custom list of files


Consider a scenario where you have to delete some files but you don't have the names of the files to delete beforehand. If you can specify that list with regular expressions, it wouldn't be a problem, but sometimes that is not possible. In such cases you should use a helper transformation that builds the list of files to delete. This recipe shows you how to do that.

For this recipe, assume that you want to delete from a source directory all the temporary files that meet two conditions: the files have a .tmp extension and a size of 0 bytes.

Getting ready

In order to create and test this recipe, you need a directory with a set of sample files; some of them should have the .tmp extension and zero size. Some example files are shown in the following screenshot:

In the preceding screenshot, the files that must be deleted are sample3.tmp, sample5.tmp, and sample7.tmp because they match the requirements of having .tmp as their file type and they do not contain anything...