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.
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
Create two sessions e.g. Session1 and Session2.
The Session1 will be your actual session for which you want to load the statistics.
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: