Property and property file (aka parameters)

A property is a named constant holding information to be supplied later. Properties let you use logical names instead of some constants, which improves flexibility and portability of the graphs. You access the value of property by its name closed into ${}, for example ${parametr_name}.
Property definitions can be nested - i.e. definition of one property can reference other property's value.
The property file defines set of properties that are used in graphs. An example below shows how to define path to workspace. Properties are stored for example in workspace.prm file.

Note: For characters that are impossible to enter directly, there are several escape sequences: \\, \n, \t, \r, \”, \f, \b. So be careful when using “\” character, eg. parameter file=c:\temp will be interpreted as “c: temp” while “\t” is interpreted as tabulator; to get “c:\temp” write file=c:\\temp.

File definition:

  # WORKSPACE = c:\\cloverETL\\examples
  WORKSPACE = /home/cloverETL/examples


Xml definition and usage:

  <?xml version="1.0" encoding="UTF-8"?>
  <Graph>
    <Global>
       ...
       <Property fileURL="workspace.prm" id="GraphParameter0"/>
       <Property id="GraphParameter1" name="outputData" value="output/customers.sorted"/>
       <Property id="GraphParameter2" name="sortKey" value="CUSTOMERID"/>
       <Property id="GraphParameter3" name="metadata" value="metadata/delimited/customers.fmt"/>
       <Property id="GraphParameter4" name="inputdata" value="data/delimited/customers_delimited.txt"/>
       <Property id="GraphParameter5" name="date" value="20070308"/>
    </Global>
    <Phase number="0">
       <Node id="INPUT1" type="DELIMITED_DATA_READER" fileURL="${WORKSPACE}/${inputdata}"/>
       <Node id="OUTPUT" type="DELIMITED_DATA_WRITER" fileURL="${WORKSPACE}/${outputData}"/>
       <Node id="SORT" type="SORT" sortKey="${sortKey}"/>
       <Node dbConnection="DBConnection0" enabled="disabled" id="DB_INPUT_TABLE0"
             sqlQuery="select * from some_table where date_format(valid_from,'%Y%m%d') = '${date}'"
             type="DB_INPUT_TABLE"/>
       <Edge id="INEDGE1" fromNode="INPUT1:0" toNode="SORT:0" inPort="0 (SORT)" 
             metadata="InMetadata" outPort="0 (INPUT1)"/>
       <Edge id="OUTEDGE" fromNode="SORT:0" toNode="OUTPUT:0" inPort="0 (OUTPUT)" 
             metadata="InMetadata" outPort="0 (SORT)"/>
    </Phase>
  </Graph>


Property definition dialog:





Defining property on command line

Clover's runGraph command has -P option with following semantics: -P:<key>=<value>. It allows you to define value of particular property (<key>) which may be later referenced inside transformation graph. For more runGraph's parameters, see running.


Defining property in CloverETL Designer

  • Right-click the Parameters category in the Outline pane and select ParametersCreate internal parameters from the context menu. In the wizard that will open, use the Plus button to define names and values of internal parameters (properties).
    Internal parameters have less priority than the external ones, the parameters defined in the Run Configurations… wizard, and those defined from the command line. They have higher priority than the environment variables. They can overwrite all environment variables and they can be overwritten by the external parameters, the parameters defined in the Run Configurations… wizard, and those defined from the command line.
  • Select FileNewOther… from the main menu. In the wizard that will open, select Graph parameter file and click Next. Again, use the Plus button to define names and values of parameters (properties) that will be external (shared) now. Click Next and select the project into which the parameters file (choose its name) should be saved. Then click OK. This file (defining external parameters) should be subsequently linked to a graph by selecting ParametersLink parameter file from the context menu.
    External parameters have less priority than both the parameters defined in the Run Configurations… wizard and those defined from the command line. They have higher priority than both the internal paremeters and the environment variables. They can overwrite all internal parameters and environment variables and they can be overwritten by the parameters defined in the Run Configurations… wizard, and those defined from the command line.


Defining property in the Run Configurations (Open Run Dialog) wizard

You can also define parameters in this wizard. You can define them either in its Main tab or Arguments tab. And in either of these two tabs, you can define individual parameters either by specifying a sequence of the individual expressions (-P:<parameterN>=<valueN>) separated by white space, or specifying the path and the name of an external file where each row defines one parameter in the following form: parameterN=valueN.
Thus, you can have: -P:paremeter1=value1 -P:parameter2=value2 … -P:parameterN=valueN or a file consisting of the rows:

parameter1=value1
...
parameterN=valueN

  • Select RunRun Configurations (or RunOpen Run Dialog, in older versions of Eclipse). Then, in its Arguments tab, type a sequence of parameters in its Program arguments textarea or type -cfg <filename> at the same place, where the <filename> will be the name and the path of the file with your parameters definition.
    These parameters have less priority than those specified in the Main tab, but they have higher priority than both the external and the internal parameters and also the environment variables. They can overwrite both the external and the internal parameter and also the environment variables. They can be overwritten by the parameters defined in the Main tab.
  • Select RunRun Configurations (or RunOpen Run Dialog, in older versions of Eclipse). Then, in its Main tab, type a sequence of parameters in its Parameter file textarea or type <filename> at the same place, where the <filename> will be the name and the path of the file with your parameters definition. They correspond to the parameters specified from the command line.
    These parameters have the highest priority and they can overwrite all other parameters defined in the other places: those specified in the Arguments tab, the external and the internal parameters and also the environment variables.


Special parameter

  • PROJECT_DIR - specifies context of all files which have relative path
graph_elements/properties.txt · Last modified: 2009/09/16 12:27 (external edit)
Back to top
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0