A query template defines the query logic required to analyze columns against regular expressions.
The steps to define a query template in Talend Studio include the following:
- Create a query template for a specific database,
- Set the database-specific regular expression if this expression is not simple enough to be used with all databases.
The below example shows how to define a query template specific for the Microsoft SQL Server database. Main concept gives a detailed example on how to create a user-defined regular expression function on an SQL server.
Before you begin
You have selected the Profiling perspective of Talend Studio.
- In the DQ Repository tree view, expand .
Double-click Regular Expression Matching, or right-click
it and select Open from the contextual menu.
The corresponding view is displayed to show the indicator metadata and its definition.
You need now to add to the list of databases the database for which you want to define a query template. This query template will compute the regular expression matching.
Click the [+] button at the bottom of the
Indicator Definition view to add a field for the new
- In the new field, click the arrow and select the database for which you want to define the template. In this example, select Ingres.
- Copy the indicator definition of any of the other databases.
Click the Edit... button next to the new field.
The Edit expression dialog box is displayed.
Paste the indicator definition (template) in the
Expression box and then modify the text after
WHENin order to adapt the template to the selected database. In this example, replace the text after
- Click OK. The new template is displayed in the field.
- Click the save icon on top of the editor to save your changes.
You have finalized creating the query template specific for the Ingres database. You can now start analyzing the columns in this database against regular expressions.
If the regular expression you want to use to analyze data on this server is simple enough to be used with all databases, you can start your column analyses immediately. If not, you must edit the definition of the regular expression to work with this specific database, Ingres in this example.
If an analysis with a user-defined indicator runs successfully at least one time and later the indicator definition template for the database is deleted, the analysis does not fail. It keeps running successfully because it uses the previously generated SQL query.
For more information on how to set the database-specific regular expression definition, see Editing a regular expression or an SQL pattern.