Using Validation Rules

by | Dec 1, 2015 | BlogPosts, Talend, Tech Tips | 0 comments

Introduction

In this blog entry, I will discuss a feature of Talend that is almost never talked about – and it’s right there in front of you. Each time you open the Repository tab and go to Metadata you will see “Validation Rules”. Well, OK, you might not see it if you have a really small screen but then what are you doing working in Talend with a tiny screen?

The feature can be enabled for most components within Talend Studio. If you take a look at any Input/Output component or tJavaRow you will notice that in the “Components” view is a “Validation Rules” pane.

2015-08-26_16-57-22

By ticking the “Use an existing validation rule” you will be able to set a validation rule.

Why?

Validation rules can simplify the design of your job by replacing functionality that would usually be assigned to filter components. This can make your job look a bit leaner, though it is then recommended to add documentation to the component using validation rules so that an external user can easily pick up the job if or whenever necessary.

What?

Validation rules provide three types of rules:

  1. Reference Check
  2. Basic Value Check
  3. Custom Check

Reference Check allows you to perform a check against a database metadata. This means that you can perform an inner join lookup against a value within a database table. You can take this one step further by creating a temporary table that can hold task specific values that are to be used in a validation rule against either an input or output component.

Basic Value Check, as the name suggests, is basic filtering for the inputs you wish to validate. Think of it as a tFilterRow component; you have all of functionality of the basic settings of that component. The only drawback is that in the function column you can select any setting regardless of input column data type, so keep that in mind.

2015-08-27_15-04-05

Custom Check is simply the advanced mode of the tFilterRow component and thus provides the option to write your own filter expression.

Conclusion

In a job where the input always has to be validated against particular column values in a database, or the input always has to follow a certain basic/advanced filtering criteria, it is wise to set up a validation rule. As a result, you will benefit from the following:

  1. Save space on your job workspace
  2. Be able to update the filtering without ever opening the job
  3. Apply the same rule in other jobs
  4. Store one extra bit of information in the repository, as a good Talend developer ought to do.

Please share the post and leave a comment if you have any questions or you know of any other useful/obscure features in Talend Studio.

 

Subscribe now for regular updates on new blog releases:

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *