Teradata Python Module - SP return value truncation against CLOB data type in python. Please help


Teradata Python Module - SP return value truncation against CLOB data type in python. Please help


   I have installed teradata python module with python 3.5.1 version. I'm calling a teradata SP that return CLOB and some VARCHAR parameters. The SP in out parameters are shown below,

TPTCLOB_Generate  (

         IN iProcess_Name            VARCHAR(30)

  ,IN iDebug_Level             BYTEINT

  ,IN iProcess_Type    BYTEINT

  ,IN iProcess_State    BYTEINT

        ,IN iTD_Server                 VARCHAR(30)

        ,IN iTD_User_Name               VARCHAR(30)

        ,IN iPassword_String           VARCHAR(30)

        ,OUT oReturn_Code               SMALLINT

        ,OUT oReturn_Message            VARCHAR(255)

  ,OUT oReturn_Script             CLOB(1000000000) -- used for returning generated TPT script

        ,OUT oReturn_Parameters         VARCHAR(4000)

        ,OUT oReturn_LogonText   VARCHAR(1000)




Now only issue i'm getting is the oReturn_Script CLOB data type contents got truncated and only 117 lines of TPT script are returned in Python result variable. But when i call the same SP from SQLA i get complete script (181 lines of total length)


Below is python call SP 

results = session.callproc("GDEV1P_FF.GCFR_FF_TPTLoadCLOB_Generate",("LD_668_66_Customer",6,17,0,"localhost","dbc","dbc",teradata.OutParam("oCode"),teradata.OutParam("oMessage"),teradata.OutParam("oScript"),teradata.OutParam("oParams"),teradata.OutParam("oLogon")))


when i print(results.oScript) or write it in a file the oScript contents were truncated. As per Teradata Python module page says the VARCHAR, CLOB, UDT, ARRAY, etc. data types are returned as Python UNICODE String. 


How can i get the complete contents? Please help!

Tags (2)

Re: Teradata Python Module - SP return value truncation against CLOB data type in python. Please help

the Python log for above python code execution.

2016-01-01 12:00:58,261 - teradata.udaexec - INFO - Initializing UdaExec...

2016-01-01 12:00:58,261 - teradata.udaexec - INFO - Reading config files: ['C:\etc\udaexec.ini: Not Found', 'C:\Users\an255019\udaexec.ini: Not Found', 'C:\Users\an255019\Desktop\teradata-\udaexec.ini: Not Found']

2016-01-01 12:00:58,261 - teradata.udaexec - INFO - Found run number file: "C:\Users\an255019\Desktop\teradata-\.runNumber"

2016-01-01 12:00:58,261 - teradata.udaexec - INFO - Cleaning up log files older than 90 days.

2016-01-01 12:00:58,261 - teradata.udaexec - INFO - Removed 0 log files.

2016-01-01 12:00:58,355 - teradata.udaexec - INFO - Checkpoint file not found: C:\Users\an255019\Desktop\teradata-\EX.checkpoint

2016-01-01 12:00:58,355 - teradata.udaexec - INFO - No previous checkpoint found, executing from beginning...

2016-01-01 12:00:58,355 - teradata.udaexec - INFO - Execution Details:


 * Application Name: EX

 *          Version: 1.0

 *       Run Number: 20160101120058-123

 *             Host: WIN10VM

 *         Platform: Windows-10-10.0.10240-SP0

 *          OS User: an255019

 *   Python Version: 3.5.1

 *  Python Compiler: MSC v.1900 32 bit (Intel)

 *     Python Build: ('v3.5.1:37a07cee5969', 'Dec  6 2015 01:38:48')

 *  UdaExec Version:

 *     Program Name: EX.py

 *      Working Dir: C:\Users\an255019\Desktop\teradata-

 *          Log Dir: C:\Users\an255019\Desktop\teradata-\logs

 *         Log File: C:\Users\an255019\Desktop\teradata-\logs\EX.20160101120058-123.log

 *     Config Files: ['C:\etc\udaexec.ini: Not Found', 'C:\Users\an255019\udaexec.ini: Not Found', 'C:\Users\an255019\Desktop\teradata-\udaexec.ini: Not Found']

 *      Query Bands: ApplicationName=EX;Version=1.0;JobID=20160101120058-123;ClientUser=an255019;Production=False;udaAppLogFile=C:\Users\an255019\Desktop\teradata-\logs\EX.20160101120058-123.log;UtilityName=PyTd;UtilityVersion=


2016-01-01 12:00:58,355 - teradata.udaexec - INFO - Creating connection: {'password': 'XXXXXX', 'method': 'odbc', 'username': 'dbc', 'system': 'tddemo'}

2016-01-01 12:01:02,792 - teradata.udaexec - INFO - Connection successful. Duration: 4.437 seconds. Details: {'password': 'XXXXXX', 'method': 'odbc', 'username': 'dbc', 'system': 'tddemo'}

2016-01-01 12:01:14,636 - teradata.udaexec - INFO - Query Successful. Duration: 0.031 seconds, Rows: 1, Query: select Process_Type from GDEV1V_GCFR.GCFR_Process where Process_Name='LD_668_66_Customer'

2016-01-01 12:01:27,120 - teradata.udaexec - INFO - Procedure Successful. Duration: 12.469 seconds, Procedure: GDEV1P_FF.GCFR_FF_TPTLoadCLOB_Generate, Params: ('LD_668_66_Customer', 6, 17, 0, 'localhost', 'dbc', 'dbc', OutParam(name=oCode, size=2), OutParam(name=oMessage, size=58), OutParam(name=oScript, size=-4), OutParam(name=oParams, size=562), OutParam(name=oLogon, size=124))

2016-01-01 12:02:39,558 - teradata.tdodbc - WARNING - 1 open connections found on exit, attempting to close...

2016-01-01 12:02:39,762 - teradata.udaexec - INFO - UdaExec exiting.

Teradata Employee

Re: Teradata Python Module - SP return value truncation against CLOB data type in python. Please help

The OutParam object takes a size argument, which is the size of the buffer to allocate to receive the value of the output parameter.   Try setting this value to a value greater than or equal to the size of the script being returned.