How to load session statistics into a Database Table
The below solution will help you to load the session statistics into a database table which can be used for audit purpose. In real life, developer generally doesn’t have access to the metadata tables. This solution will help to get the session statistics for audit purpose.
Solution:
Create a Database table to store the session statistics. Note: The following syntax is for Sybase DB. Please change according to your DB. create table Infa_Audit ( workflow_name varchar(50), start_time datetime, end_time datetime, success_rows numeric, failed_rows numeric ) Create two sessions e.g. Session1 and Session2.
Session1: The Session1 will be your actual session for which you want to load the statistics.
Session2: Session2 will be used to load the statistics of Session1 into database table. For this, create a mapping and define the below mapping variables
The flow of Mapping should look like this
Where, Source will be a dummy source and inside the expression assign all the mapping variables to output ports. The audit table will be the target.
The workflow will look like as shown below.
Create workflow variables as shown below
Assign the values to workflow variables in Assignment Task as shown below
In the Pre-session variable assignment tab of Session2, assign the mapping variables to workflow variable as shown below:
Execute the workflow. |
No comments:
Post a Comment