This section illustrates TPT translation from Teradata to Snowflake.
TPT statements transformation
All TPT statements, like other Teradata scripting languages, are being converted to python code. Here are some examples of transformations already supported.
Define Job header transformation
The job statement is translated to a python class with all the statements like operators, schema definitions, and steps inside of it.
Source code
/* Some comments on the job */DEFINE JOB LOADJOBDESCRIPTION'LOAD AC_SCHEMA TABLE FROM A FILE'JobBody
Translated code
# Some comments on the jobclassLOADJOB:# DESCRIPTION 'LOAD AC_SCHEMA TABLE FROM A FILE' JobBody
Define Schema transformation
The schema statement is translated to an attribute in the class created for the job statement.
classJOBNAME: DCS_SCHEMA ="""( PNRHEADER_ID VARCHAR(24), PNRLOCPERIOD VARCHAR(58), CRTDATE VARCHAR /*** MSC-WARNING - SSC-FDM-TD0002 - COLUMN CONVERTED FROM CLOB DATA TYPE ***/, REQTYP VARIANT, seqno INTEGER, resdata INTEGER, );"""
Define Operator transformation
The operators are translated to python functions inside the class generated for the job. The examples provided are the operators that SnowConvert currently supports
defsetup_tables(self): self.DDL_OPERATOR()exec(f"""DELETE FROM DATABASE1.{STAGE_DB_NAME}.EMS_AC_MASTER_STG""")defstLOAD_FILE_NAME(self):exec(f"""INSERT INTO DATABASE1.CRASHDUMPS.EMP_NAME (EMP_NAME, EMP_YEARS, EMP_TEAM)SELECT EMP_NAME, EMP_YEARS, EMP_TEAMFROM ({self.ol_EMP_NAME('SELECT * FROM '+ self.op_EMP_NAME() )})""")
Main function
The main function is always generated for any scripting language, for TPT the main function contains an instance of the job class and calls to the steps in the job