Managing scenarios
Introduction
Scenario is a procedure that consists of a sequence of operation calls. Scenario is a basic mechanism to perform operations on data sources that is used to implement all kind of applications: ETL, Data Quality, etc. Operations in scenarios usually take a data source name (created in the Sources section), space name, table name, operation-specific parameters, and target source name, target space name, target table name. The latter target parameters are about where the result of the operation will be stored. Many operations takes specification name (created in the Specification section) as a parameter and execute the specification. Such operations does not require source and target parameters as they are usually part of specifications.
Create scenario
-
Right click on the Scenarios section in the navigation tree and select Create scenario.
-
Enter Scenario name and click Create button. Scenario will be created and added to the Scenarios section.
Delete scenario
-
Right click on the source name in the Scenarios section and select __Detele_.
-
Confirm that you want to delete the scenario by clicking OK button.
Create operations in scenario
Operations are always part of a scenario. There are several ways to create an operation in a scenario: append as the last operation to a scenario; insert operation before or after an existing operation in a scenario.
How to append operation to scenario:
-
Right click on the scenario name, hover over Append operation, select an operation. The current window will display the operation window.
-
Enter operation-specific parameters in the operation window.
How to insert operation before or after an existing operation:
-
Expend a scenario by clicking on > sign on the left of the operation name.
-
Write click on the operation title (which usually constructed from the operation name and the most descriptive parameter separated by :), hover over Insert operation before or Insert operation after, and select an operation. The current window will display the operation window.
-
Enter operation-specific parameters in the operation window.
Delete operation
- Right click on the operation title and select Delete.
Run scenario
Scenario is executed as an asynchronous job: you get the identifier of the job as you start it without waiting for its completion; you query status of the job using its identifier until its completion.
-
Right click on the scenario name and select Run. The current window will show the identifier of the job started to execute the scenario.
-
Click on Activity Log in the navigation tree to see the status of the job. The status can be running, completed, completedWithError. Keep on clicking periodically on the Activity Log to update the log (it is not being updated automatically).
-
Expend a record representing the job in the Activity Log to see the details on the current progress: it shows a list of operations that were already completed.
Run operation
You can run a single operation in a scenario. It is useful for debugging purposes. Operation is executed as a synchronous job: the current window will show a spinner until execution is completed; then the result will be shown.
- Right click on the operation title and select Run. The current window will show the running status and then the result.
Scenario parameterization
There are two ways to pass input to the scenario: parameters and input tables. The difference is that parameters are scalar values of String type and input tables are for passing data sets.
Passing parameters to a scenario
Parameters is a set of name-value pairs that is added to the execution
context of a scenario. Any parameter of all operation inside the
scenario is evaluated as a template literal and you can use variable
references (such as ${parameter_name}) to refer to the scenario
parameters. See Template literals section for more
information.
You can pass scenario parameters using JSON format:
-
In the
Scenario parametersparameter of RunScenario operation. -
By right clicking on a scenario, selecting Run with parameters…, and entering the scenario parameters in the Parameters textbox.
Passing input tables to a scenario
You can pass one or more input tables to a scenario. For each input table do the following:
-
Create a model to define its schema. Use the Columns section of the model specification to list columns (namely, column name and type) of the input table. The schema will be used to create the input table on scenario execution.
-
By right clicking on a scenario, selecting Properties, navigate to the Input tables section, click +Add button and enter the properties as follows:
-
Name can be any. It is used to refer to the input table when you pass records of the input table in a scenario call.
-
Source, Space, and Table define the input table location and name. On each scenario execution (if you pass any records) table with the name will be re-created. You can use this table in any operation of the scenario. The table is not automatically dropped after scenario execution, which is useful for debugging purposes. You can drop it explicitly in your scenario (using DropTable operation) or you can mark this table as temparary as described below.
-
In the Model property, select the model that you created at the previous steps. The Coloumns section of the model is used as a schema to create the input table.
-
Tmp Table property can be true or false. Temporary tables are used to avoid conflicts when you run the same scenario in parallel. Temporary tables are also dropped automatically at the end of scenario execution. You can refer to temporary tables using their names (the same way as to persistent tables) but internally temporary tables are created with uniquely generated names and InfoLink does the mapping.
-
To pass records for the input table on scenario call, use the following
JSON format: [{"name":"<name>", "data":[{"<col name>":"<col value>","<col name>":"<col value>"}]}]. Where <name> is the value of
the Name property you specified in the Input tables section of
the scenario properties (not the Table property). The number and
names of the columns must match the model specification. Notice that
this JSON is an array - this is how you pass data for multiple input
tables.
You can pass records to the input table using the JSON format in one of the following ways:
-
Via Data parameter of RunScenario operation.
-
Right click on a scenario in the navigation tree, select Run with parameters…, enter records in the JSON format to the Data textbox.