34,79 €
Data integration is a key component of an organization's technical strategy, yet historically the tools have been very expensive. Talend Open Studio is the world's leading open source data integration product and has played a huge part in making open source data integration a popular choice for businesses worldwide.This book is a welcome addition to the small but growing library of Talend Open Studio resources. From working with schemas to creating and validating test data, to scheduling your Talend code, you will get acquainted with the various Talend database handling techniques. Each recipe is designed to provide the key learning point in a short, simple and effective manner.This comprehensive guide provides practical exercises that cover all areas of the Talend development lifecycle including development, testing, debugging and deployment. The book delivers design patterns, hints, tips, and advice in a series of short and focused exercises that can be approached as a reference for more seasoned developers or as a series of useful learning tutorials for the beginner.The book covers the basics in terms of schema usage and mappings, along with dedicated sections that will allow you to get more from tMap, files, databases and XML.
Geared towards the whole lifecycle, the Talend Open Studio Cookbook shows readers great ways to handle everyday tasks, and provides an insight into all areas of a development cycle including coding, testing, and debugging of code to provide start-to-finish coverage of the product.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 297
Veröffentlichungsjahr: 2013
Copyright © 2013 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: October 2013
Production Reference: 2221013
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78216-726-6
www.packtpub.com
Cover Image by Artie Ng (<[email protected]>)
Author
Rick Barton
Reviewers
Robert Baumgartner
Mustapha EL HASSAK
Viral Patel
Stéphane Planquart
Acquisition Editor
James Jones
Lead Technical Editor
Amey Varangaonkar
Technical Editors
Monica John
Mrunmayee Patil
Tarunveer Shetty
Sonali Vernekar
Project Coordinator
Abhijit Suvarna
Proofreader
Clyde Jenkins
Indexer
Tejal R. Soni
Production Coordinator
Adonia Jones
Cover Work
Adonia Jones
Rick Barton is a freelance consultant who has specialized in data integration and ETL for the last 13 years as part of an IT career spanning over 25 years.
After gaining a degree in Computer Systems from Cardiff University, he began his career as a firmware programmer before moving into Mainframe data processing and then into ETL tools in 1999.
He has provided technical consultancy to some of the UK’s largest companies, including banks and telecommunications companies, and was a founding partner of a “Big Data” integration consultancy.
Four years ago he moved back into freelance development and has been working almost exclusively with Talend Open Studio and Talend Integration Suite, on multiple projects, of various sizes, in UK. It is on these projects that he has learned many of the lessons that can be found in this, his first book.
I would like to thank my wife Ange for support and my children, Alice and Ed for putting up with my weekend writing sessions.
I’d also like to thank the guys at Packt for keeping me motivated and productive and for making it so easy to get started. Their professionalism and most especially their confidence in me, has allowed me to do something I never thought I would.
Robert Baumgartner has a degree in Business Informatics from Austria, Europe, where he is living today. He began his career in 2002 as a business intelligence consultant working for different service companies. After this he was working in the paper industry sector as a consultant and project manager for an enterprise resource planning (ERP) system. In 2009 he founded his company “datenpol”—a service integrator specialist in selected open source software products focusing on business intelligence and ERP. Robert is an open source enthusiast who held several speeches at open source events. The products he is working on are OpenERP, Talend Data Integration, and JasperReports. He is contributing to the open source community by sharing his knowledge with blog entries at his company blog http://www.datenpol.at/blog and he commits software to github like the OpenERP Talend Connector component which can be found at https://github.com/baumgaro/OpenERP-Talend-Component.
Mustapha EL HASSAK is a computer sciences fanatic since many years, he obtained a Bachelor’s Degree in Mathematics in 2003 then attended university to study Information Technology. After five years of study, he joined the largest investment bank in Morocco as an IT engineer. After that he worked in EAI, an IT services company specialized in insurance, as a senior developer responsible of data migration. He has always worked with Talend Open Studio and sometimes with Business Objects. This is the first time he is working on a book, but he wrote several articles in French and English about Talend on his personal blog.
I would like to thank my parents, Khadija and Hassan, Said, my brother and Asmae, my sister for their support over the years. And I express my gratitude to Halima, my wife for her continued support and encouragement. Finally, I would like to thank Sirine, my little girl.
Viral Patel holds Masters in Information Technology (Professional) from University of Southern Queensland, Australia. He loves playing with Data. His area of interest and current work includes Data Analytics, Data Mining, and Data warehousing. He holds Certification in Talend Open Studio and Talend Enterprise Data Integration. He has more than four years of experience in Data Analytics, Business Intelligence, and Data warehousing.
He currently works as ETL Consultant for Steria India Limited. It is an European MNC providing consulting services in various sectors. Prior to Steria, he was working as BI Consultant where he has successfully implemented BI/DW cycle and provided consultation to various clients.
I would like to thank my grandfather Vallabhbhai, father Manubhai (who is my role model), mother Geetaben, my wife Hina, my sister Toral and my lovely son Vraj. Without their love and support, I would be incomplete in my life. I thank them all for being in my life and supporting me.
Stéphane Planquart is a Lead Developer with a long expertise in Data Management. He started to program when he was ten years old. In twenty years, he worked on C, C++, Java, Python, Oracle, DB2, MySql, PostgreSQL. From the last ten years, he worked on distinct types of projects like the database of the largest warehouse logistics in Europe where he designed the data-warehouse and new client/server application. He worked also on an ETL for the electric grid of France or 3D program for a web browser. Now he works on the application of a payment system in Europe where he designs database and API.
You might want to visit www.PacktPub.com for support files and downloads related to your book.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Packt’s online digital book library. Here, you can access, read and search across Packt’s entire library of books.
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.
Talend Open Studio is the world’s leading open source data integration solution that enables rapid development of data transformation processes using an intuitive drag-and-drop user interface.
Talend Open Studio Cookbook contains a host of techniques, design patterns, and tips and tricks, based on real-life applications, that will help developers to become more effective in their use of Talend Open Studio.
Chapter 1, Introduction and General Principles, introduces some of the key principles for Talend development and explains how to install the provided code examples.
Chapter 2, Metadata and Schemas, shows how to build and make use of Talend data schemas.
Chapter 3, Validating Data, demonstrates different methods of validating input data and handling invalid data.
Chapter 4, Mapping Data, shows how to map, join, and filter data from input to output in both batch and real-time modes.
Chapter 5, Using Java in Talend, introduces the different methods for extending Talend functionality using Java.
Chapter 6, Managing Context Variables, illustrates the different methods for handling context variables and context groups within Talend projects and jobs.
Chapter 7, Working with Databases, provides insight into reading from and writing to a database, generating and managing surrogate keys, and managing database objects.
Chapter 8, Managing Files, covers a mix of techniques for reading and writing different file types including header and trailer processing. It also includes methods for managing files.
Chapter 9, Working with XML, Queues, and Web Services, covers tools and techniques for real-time/web service processing including XML, and reading and writing to services and queues.
Chapter 10, Debugging, Logging, and Testing, demonstrates the different methods for finding problems within Talend code, and how to log status and issues and techniques for generating test data.
Chapter 11, Deployment and Scheduling Talend Code, introduces the Talend executable and parameters, as well as managing job dependencies.
Chapter 12, Common Mistakes and Other Useful Hints and Tips, contains valuable tools and techniques that don’t quite fit into any of the other chapters.
Appendix A, Common Type Conversions, is a useful table containing the methods for converting between Talend data types.
Appendix B, Management of Contexts, is a in-depth discussion as to the pros and cons of the various methods for managing project parameters, and what types of projects the different methods are suited to.
To attempt the exercises in this book, you will need the following software
It is also recommended that you find a good text editor, such as Notepad++.
This book is intended for beginners and intermediate Talend users who have a basic working knowledge of the Talend Open Studio software, but wish to know more.
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>, and mention the book title via the subject of your message.
If there is a topic that you have expertise and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the erratasubmissionform link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]> with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.
The aim of this book is to provide you, the Talend developer, with a set of common (and sometimes not so common) tasks and examples that, we hope, will help you in:
This cookbook is primarily intended as a reference guide, however, the chapters have been organized in such a way that it can also be used as a means of rapidly developing your Talend skills by working through the exercises in sequence from front to back.
For the more experienced developers, some of the recipes in this book may seem very simple, because they describe a feature of Talend that you may already know, but we are hoping that this isn't the case for everyone, and that there will be something in the book for developers of all levels of experience.
Many of the recipes in the book require you to complete sections of a partially built job, so it is assumed that in the real world you would be able to get to the starting point independently. Our thinking behind this is that we wanted to squeeze in as many recipes in the book as possible, so only the relevant steps that need to be performed and understood for a particular point to be made, are described in detail within each recipe.
Many any of the examples will write their output to the Talend log/console window when we could easily have written the data out to files or tables. However, the decision was made to provide an easy means (in most cases) of viewing the results of an exercise without having to leave the studio.
Before you begin the exercises in the book, it is worth becoming familiar with some of the key concepts and best practices.
Keep code changes small and test often
When developing using Talend, as with any other development tool, it is recommended to code in short bursts and test (run) frequently.
By keeping each change small, it is much easier to find where and what has caused problems during compilation and execution.
Chapter 10, Debugging, Logging, and Testing, is dedicated to debugging and logging; however, observing the preceding method will save time having to perform debugging steps that can sometimes take a long time.
Document your code
Talend sub-jobs have the ability to add titles, and every component in Talend has the option to add documentation for the component. Where you use Java, you should use the Java comment structures to document the code. Remember to use all these methods as you go along to ensure that your code is well documented.
Contexts and globalMap
context and globalMap are global areas used to store data that can be used by all components within a Talend job.
context variables are predefined prior to job execution in a context group, whereas globalMap variables are created on the fly at any point within a job.
Context variables
Context variables are used by Talend to store parameter information, and can be used:
Chapter 6, Managing Context Variables, is dedicated to the use and management of context variables within Talend
globalMap
globalMap is a very important construct within Talend, in that:
Java
Talend is a Java code generator, so having a little Java knowledge can help when using Talend. There are many Java tutorials for beginners online, and a little time spent learning the basics will help speed up your understanding of Talend.
Other background knowledge
As a data integrator, you will be expected to understand many technologies and how to interface with them, and this book assumes a basic knowledge of many of the most frequent data sources and targets.
Chapter 7, Working with Databases, relates to using Talend with databases. We have chosen to use MySQL, because it is quick to install, simple to use, and readily available. Basic knowledge of SQL and MySQL will therefore be required to perform the exercises in this chapter.
Other chapters will also assume knowledge of csv files, MS Excel, XML, and web services.
This cookbook comes with a package of jobs and scripts that you will need to complete the recipes. The instructions for installing the code and scripts are detailed in the following section:
Many of the exercises rely on the use of tHashInput and tHashOutput components. Talend 5.2.3 does not automatically enable these components for use in jobs. To enable these components perform the instructions in the following section:
This chapter contains a detailed discussion about metadata and Talend schemas and recipes that highlight some of the less used / less known features associated with schemas, along with more commonly used features, such as generic and fixed schemas:
Managing metadata is one of the most important aspects of developing Talend jobs, and the most common form of metadata used within Talend jobs is the schema.
For successful development of jobs, it is essential that the metadata defined for a data source accurately describes the format of its underlying data. Failure to correctly define the data will result in numerous errors and waste of time tracking down problems with data formats that could otherwise be avoided.
Talend provides a host of wizards for capturing metadata from a variety of data sources such as database tables, delimited files, and Excel worksheets and stores them within its built-in metadata repository.
Talend stores metadata definitions in schemas, which may be built in to individual components or stored in its metadata repository, as shown in the following screenshot:
