Parameterization

Centerprise provides an option to parameterize some values for an object in a flow, which allows them to be replaced during runtime. Parameterized values in the Config Parameters section are typically the most commonly changed values, and the availability of these parameters vary depending on the object. If an object supports parameterization, a Config Parameters wizard page will be shown for that object.

01-Delim-Source-config-param

Parameters can provide smoother deployment of flows by eliminating hardcoded values and provide an easier way of changing multiple configurations with a simple value change.

Parameters can be changed in the Config Parameters wizard page. If left blank, they will use their default values assigned on the properties page.

Parameter Values

Values assigned to parameters can be a string representation of the allowed value type or a variable surrounded by curly brackets {}. Variables inside parameters are replaced during runtime with their assigned values denoted in a Variables object or Config File.

Variables on a flow can be declared locally by using a Variables object, or project-wide by using a Config File. The Config Parameters screen replaces any string with the form of:

{}

A combination of variables and/or values can be applied to the parameters, for example:

C:\Files{File}

{Directory}{File}

Config File

Config Files are used in projects to store project-wide variables and their values. These variables are Name-Value pairs with string representations of values that can be used in the Config Parameters window. Config Files can be created in Centerprise from the main menu or added from the project menu.

02-Config-File

Config Files are best used inside a project. Any files opened within Centerprise will have access to the variables inside the set Config File of the currently active Project.

A Config File needs a Name Value pair. Names accept alphanumeric characters and the ‘_’ (underscore) symbol. The Values are string representations of values to be assigned.

Deployment

The Centerprise Scheduler provides an option to deploy a project with an optional Config File. For more information about deployment see Project Deployment.

Examples

Parameterizing the Source File Path

File path for Delimited Sources can be parameterized enabling it to be changed during runtime and whenever necessary. This gives the ability to have the source file path to be declared independently from the flow. A way to set the parameters is to declare the path as a variable in a Variables object.

03-Variable-object

The flow can use the variables as values for the Config Parameters for any object contained within the flow.

04-Dataflow

For this example, we have a simple flow that transfers data from a delimited source to a delimited destination. The FilePath for a Delimited File Source can be modified using parameters in the Config Parameters screen.

05-Config-param-delim

The values entered for FilePath will be changed during runtime. The job trace will reflect the change.

06-Parameter-Resoled

To use a Config File as a source for the parameter, we need to create a project and add a Config File along with the Dataflow.

07-Project-explorer

The Config File behaves similarly as the Variables object by supplying a Name and a Value.

08-ConfigFileSample

The Name can then be used inside the Config Parameters screen.

09-Config-file-params

Parameterizing in SQL Query Source

Variables can be utilized while querying data from database tables in the SQL Query Source object. These can be changed according to the requirement. Here, we wish to query data from a sample Orders table after particular dates. Instead of editing the query multiple times, we have used a Variables object where we can change the date as needed.

10-‎Variable-SQL-Query

Now, we can write the query in the SQL Query Source.

11-SQL-Query

In order for the query to correctly compute the date variable, we have to specify it within single quotes as shown.

We can preview the output for the SQL Query Source to confirm the query is correctly applied.

12-Preview-Output-SQL-query

Parameterizing in Database Source

Variables can be used in the Database Table Source object while querying particular records from a Database table. Here, we wish to get the records of particular customers using their Customer ID. Instead of editing the Where clause multiple times, we can just use the variable object.

13-Variable-customer

After defining the variable, we can write the Where clause in the Database Source.

14-Where-Clause

Over here, for the string, we again specify the variable in single quotes to ensure the computation. We can preview the output of the Database source to confirm the working.

15-where-output

Parameterizing in a Run SQL Script

Variables can also be utilized in a Run SQL Script whilst querying data from a database table. Here, we wish to get the order details of those orders where the items ordered have a particular quantity. Instead of editing the query multiple times for different quantities, we can just use a variable.

16-variable-order-quant

After defining the variable, we can use it in the SQL query.

17-quant-query

As our variable contains an integer value, we do not have to specify it in single quotes and can write it as is.

Parameterization is available throughout the Astera Data Platform. To see how it works in the request context in data services, click here.

This concludes our discussion on Parameterization in Astera Centerprise.