Teradata/PyTd

Can not pass a NULL INPUT parameter to stored procedure

alokagg opened this issue · 2 comments

I have a need to pass a 'NULL' parameter to my stored procedure, called from python code. The Python native null object , named 'None' doesn't seem to be recognized by the Teradata Python module.
code snippet:

vjobid = raw_input("Job ID : ")
vjobnm = raw_input("Job Name : ")
vstarttm = raw_input("Enter Start Time : ")
vnull = None

udaexec = teradata.UdaExec ()
with udaexec.connect("MYTD") as session:
results = session.callproc("MYDB.MYPROC",
(teradata.OutParam("resultcode1"),
teradata.OutParam("resultstate1"),
teradata.OutParam("resultmsg1"),
teradata.InOutParam(vnull,"inout_schid"),
vjobid,vjobnm,1,vstarttm,"N","N"))
print(results.resultcode1)
print(results.resultstate1)
print(results.resultmsg1)

Got error in log, as follows

AttributeError: 'NoneType' object has no attribute 'raw'

I am able to reproduce the problem. I will release a fix shortly. Thanks for reporting.

Reopening issue as even though the error described above is resolved, when None is passed as an INOUT parameter to stored procedure the value is passed to the SP as 0 or an empty string and not NULL.