Friday, 4 November 2016

read context variable values from csv file in Talend open studio (or) tContextLoad component example

Hi..

Uhhh..!!!(Welocming myself)  It's been a long time I had involved in some ETL work and in concepts. I'm back to the drawing board especially with Talend or Jasper ETL with open studio. In 2016(end)-17, I am planning to write about Talend/Japser ETL on the real time concpets, scenarios and comparision solutions of Talend with Pentaho Kettle ETL along with Japsersoft BI and Pentaho BI reports/dashboards. (the past years were more on BI and visualizations and now its time to learn and share knowledge on real time data projects).  Parallelly, you may find begineers articles on other BI technologies such as Tableau and Microstrategy in a new blog site.(plan for 2017)

Coming to the subject of this tutorial  below is a sample scenario 
In this tutorial, you will learn about how to fetch/load context variable values from a csv file. In other words, you can learn how effectively can use tContextLoad component.
This concept is useful when deploying ETL projects in Linxu environment and remember that all the time we won't go wtih hard coded values in context variables instead try to load key-value paried values from a file.

Softwared used:
Talend open studio version: 6.2.1.20160704_1411
CSV file (context.csv)

context.csv
host; localhost
port; 5432
database; foodmart
schema; public
username; postgres
password; postgres

Step-1 : 
Drag and drop tFileInputDelimited, tContextLoad,tLogRow,tMsgBox to the canvas and connect them as shown in below image.


Step-2: Define context variables, click on context tab of job and then click on + button to add below shown context variables.


Step-3: Read context.txt file from tFileInputDelimited component


Step-4: set properties in tContexLoad compoent


Step-5: Connect tContextLoad to tLogRow and on error connect to tMsgBox as shown in first image.

NOTE: This article is not a prodcution ready one rather it gives idea or knowledge that can be used in your environments.



References : 
1) http://etladvisors.com/2014/03/21/tcontextload/
2) https://help.talend.com/display/TalendOpenStudioComponentsReferenceGuide521EN/16.5+tContextLoad