Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between .ini and .properties files in relevance to Talend?

Tags:

talend

.properties file extension is used for loading context variables through a file in Talend. In tFileProperties, while selecting the file format for parameter file, we have a drop down of .properties and .ini extension also. I want to know what is the difference between .ini and .properties file format in relevance to parameter file extensions in Talend. In which case we use .ini extension?

Documentation says that the only difference is that the .ini files are regrouped in sections, which are somewhat iterated, which I failed to understand. Can anyone elaborate with an example?

like image 293
GadaaDhaariGeek Avatar asked Jan 29 '23 02:01

GadaaDhaariGeek


1 Answers

Both file types allow you to declare key/value pairs like so:

key=value

The difference between the two is that .ini uses sections. tFileInputProperties allows you to read a section by its name:

enter image description here

The big advantage of this over .properties file is that .ini file can have the same variable inside multiple sections. For instance, your sections can be your execution environments (DEV, PROD..etc) with your variable having a different value for each environment. You can then get the value by reading only the section corresponding to your execution environment (section can be a context variable).

enter image description here

This what I get by setting section to "DEV":

enter image description here

If you declare the same variable in .properties file multiple times, the last occurence of the variable is the one that will be returned. Suppose my file looks like this :

enter image description here

This is the result (notice how only 2 rows are read, and not the 4 present in the file)

enter image description here

like image 154
Ibrahim Mezouar Avatar answered May 16 '23 08:05

Ibrahim Mezouar