How to extract the count for source & target records in TPT

Tools & Utilities
Enthusiast

How to extract the count for source & target records in TPT

Good Morning TPT experts!

I need some help to extract counts from TPT.

I am trying to provide some assertions to users based on the number of records read from the source and number of records loaded into TD.

Is there any diagnostics functions present in TPT to extract the count of source records processed and number of records loaded into TD.

I have some details in the log file like these below .

LOYALTY_REDEMPTION_INFO_odbc: sending SELECT request

LOYALTY_REDEMPTION_INFO_odbc: data retrieval complete

LOYALTY_REDEMPTION_INFO_odbc: Total Rows Exported:  576369

LOYALTY_REDEMPTION_INFO_updt: entering Application Phase

LOYALTY_REDEMPTION_INFO_updt: Statistics for Target Table:  'LOYALTY_REDEMPTION_STG'

LOYALTY_REDEMPTION_INFO_updt: Rows Inserted: 576369



Can anyone suggest how can I get these highlighted values without parsing the logs?.

5 REPLIES
Junior Contributor

Re: How to extract the count for source & target records in TPT

MERGE can't be used for Inserts into a table with a Identity PI (unless it's a single row).

You need to use two statements using old-school UPDATE WHERE EXISTS & INSERT/SELECT WHERE NOT EXISTS.

Teradata Employee

Re: How to extract the count for source & target records in TPT

Take a look in the TPT binary job log at the TWB_STATUS private log:

command: tlogview -j <job-id> -f TWB_STATUS

We provide that data in a fixed type format.

We also publish in the manual (TPT User Guide) the schema for the data in that private log.

If you export that to a file, you will have access to some data items like CPU time, start and end times, and row counts.

That output might be easier to parse to get row counts, than the text in the operator logs.

-- SteveF
Enthusiast

Re: How to extract the count for source & target records in TPT

Just had one quick question regarding TPT. In order to read the tpt logs, the only way is to use the tlogview command right?

Is there any setting in TPT that allows it to generate the job log in readable format already (so that we can do a cat or a more on the job log directly) so that we don't have to use the command tlogview to view the job log?

-Suhail

Teradata Employee

Re: How to extract the count for source & target records in TPT

There is no option to TPT to automatically generate a script in readable form.

You must use the tlogview command.

However, we added a way to do that from within a script.

We provide a $JOBID macro so in the script you can use that macro in an execution of the tlogview command (using the OS Command operator) to generate the output.

Just use the concatenation:

'tlogview -j ' || $JOBID || ' -f "*" -g '

(if that is the tlogview command you are trying to execute in order to generate the log)

You can also pass a variable into the script and then redirect the output to a file with that name:

'tlogview -j ' || $JOBID || ' -f "*" -g > ' || @my_output_file

-- SteveF
Enthusiast

Re: How to extract the count for source & target records in TPT

Thank you for the info Feinholz.

-Suhail