Kettle parameters and variables

Source: Internet
Author: User

Kettle parameters and variables

 

In versions earlier than kettle 3.2, only variable and argument are available. Kettle 3.2 introduces the parameter concept. variable is environment variables (environment or global variable ), even different conversions have the same value, while argument (location parameter) and parameter (name parameter) can be mapped to a local variable, only for a specific conversion, for example, you can specify the result set size and filter conditions.

1. Variable)

Variables can also be considered as environment variables. Like its name, variables are mainly used to set environment variables, such as the most common one: file storage address and SMTP configuration, you can also think of it as a global variable in a programming language. Even different conversions have the same value;

Variables can be used in conversions or jobs.Set variableThe step is defined or defined in the kettle. properties file. The default path of the file is as follows:

$ Home/. Kettle (Unix/Linux/OSX)

C: \ Documents andsettings \ <username> \. Kettle \ (Windows)

C: \ Users \ <username> \. Kettle \ (Windows Vista)

 

1.1 define global variables in the kettle. properties File

Open the file and define it directly in it, for example, today = to_char (sysdate, 'yyyy-mm-dd'). database functions are supported here, which is more straightforward, what is defined here, so what is it obtained in transformation. You can directly % v_yes_date %, or $ {v_yes_date} as needed. Note that if you want to edit Chinese characters, you need to edit the navationtoascii tool or in eclipse. Define play, save, and restart spoon to take effect.

 

2. garument (location parameter)

In versions earlier than kettle 3.2, only argument, also known as positional arguments, is a maximum of 10 command line parameters that can be set.

3. parameter (named parameter)

In kettle 3.2, the parameter concept is introduced, which can be distinguished by name and can be set in the command line by/Param: Name = value, in addition,/listparam can list the parameter defined in a Ktr or kjb.


The name parameter can be defined in the conversion or job Setting dialog box, and the default value is given during definition. When a job or conversion is run in spoon, enter the value of the name parameter in the run dialog box. When running the command line, you can also assign values to each named parameter through-Param: Name = value. Param: Name = value is an integral block in the command line and is considered as a command parameter.

For example, run the job. kjb file, which has two parameters: files. dir =/opt/files, Max. Date = 2010-06-02

Linux:./kitchen. Sh-file: job. kjb-Param: files. dir =/opt/files-Param: Max. Date = 2010-06-02
Windows: Kitchen. Bat-file: job. kjb "-Param: files. dir =/opt/Files" "-Param: Max. Date = 2010-06-02 ″

Naming parameters can be used as variables. during runtime, they are named and mapped to variables. If you have defined the name parameter Foo, You can reference it anywhere through $ {Foo }.

Kettle parameters and variables

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.