Search code examples
csvtalend

Adding static files to Talend jobs


I'm using Talend Open Studio for Big Data and I have a job where I use tFileInputDelimited to load a CSV file and use it as a lookup with a tMap.

Currently the file is loaded from the disk using an absolute path (C:\work\jobs\lookup.csv) and everything works fine locally.

The issue is that when I deploy the task, it obviously doesn't take the lookup.csv file with it.

Which begs a question:

Is there any way to "bundle" this file (lookup.csv) into the job so I can later deploy them together?


Solution

  • With static data such as this your best bet is to hard code the data into the job using a tFixedFlowInput instead.

    As an example, if we want to use a list of country names, their ISO2 and ISO3 codes you might have these in a CSV that you'd normally access with a tFileInputDelimited. However, to save bundling this CSV with every build (which could be done with ANT/Maven) you can just hard code this data into a tFixedFlowInput:

    tFixedFlowInput component with hard coded comma delimited country data

    You then just need to make sure your schema is set up as the same as your delimited file would have been (so in this case we have 3 columns: Country_Name, ISO2 and ISO3).