Teradata Python Module

Tools
Tools covers the tools and utilities you use to work with Teradata and its supporting ecosystem. You'll find information on everything from the Teradata Eclipse plug-in to load/extract tools.

Re: Teradata Python Module

Ranjith - Try this in your DSN config:

authentication=ldap


Re: Teradata Python Module

@davebutler , Thanks that worked. Appreciate the help

authentication=ldap

Enthusiast

Re: Teradata Python Module

Can anybody give me simple example ?? How to compile and execute store procedures from teradata python module??

Enthusiast

Re: Teradata Python Module

I want example of parametric store procedure..atleast one IN and one OUt paramter ..

Teradata Employee

Re: Teradata Python Module

Here is a simple example of creating and calling a SQL Stored Procedure with both an input and output parameter.   Note that Teradata REST and ODBC do not support creating non-SQL based Stored Procedures (e.g. C and Java) at this time, so only SQL-based Stored Procedures can be created with the Python module.

  for result in session.execute(
"""REPLACE PROCEDURE test.testProcedure1
(IN p1 INTEGER, OUT p2 INTEGER)
BEGIN
SET p2 = p1;
END;"""):
print(result)

result = session.callproc(
"test.testProcedure1",
(12345, teradata.OutParam("p2", dataType="INTEGER")))
print(result.p2)
Enthusiast

Re: Teradata Python Module

Thanks eric..

Enthusiast

Re: Teradata Python Module

I'm getting this error when trying to connect from linux. 

any ideas ?

Traceback (most recent call last):

  File "test1.py", line 6, in <module>

    session = udaExec.connect(method="odbc", system="oneview",username='xxxxx', password='xxxx');

  File "/prod/user/sam/ent/fdm/Users/IUA019/miniconda/lib/python2.7/site-packages/teradata/udaexec.py", line 181, in connect

    **args))

  File "/prod/user/sam/ent/fdm/Users/IUA019/miniconda/lib/python2.7/site-packages/teradata/tdodbc.py", line 374, in __init__

    checkStatus(rc, hDbc=self.hDbc, method="SQLDriverConnectW")

  File "/prod/user/sam/ent/fdm/Users/IUA019/miniconda/lib/python2.7/site-packages/teradata/tdodbc.py", line 206, in checkStatus

    raise DatabaseError(i[2], u"[{}] {}".format(i[0], msg), i[0])

teradata.api.DatabaseError: (0, u'[I] [')

Teradata Employee

Re: Teradata Python Module

@privet3711 - Whenever these non-sense error codes/messages come back from the ODBC driver manager, it usually means the Teradata ODBC driver was not found.  This could be either because its not not installed, or the ODBCINI environment variable is not set, or the unixodbc driver manager was being loaded instead of the DataDirect driver manager that comes with the Teradata ODBC driver.  I added code to the python module to try to detect these cryptic errors messages and display a more informative message but "[I] [" is not something I've seen.  I would check your Teradata ODBC install, make sure the ODBCINI environment variable is set, and check that unixodbc is not installed.

Not applicable

Re: Teradata Python Module

The module seems to have issues with paired curly braces ({}) inside passwords. I was able to work around this by putting my password inside double quotes. Here is the the Traceback:

Traceback (most recent call last):

  File "/Users/mhousley/anaconda/lib/python3.5/site-packages/teradata/udaexec.py", line 181, in connect

    **args))

  File "/Users/mhousley/anaconda/lib/python3.5/site-packages/teradata/tdodbc.py", line 374, in __init__

    checkStatus(rc, hDbc=self.hDbc, method="SQLDriverConnectW")

  File "/Users/mhousley/anaconda/lib/python3.5/site-packages/teradata/tdodbc.py", line 206, in checkStatus

    raise DatabaseError(i[2], u"[{}] {}".format(i[0], msg), i[0])

teradata.api.DatabaseError: (0, '[HY000] [Teradata][ODBC Teradata Driver] Major Status=0x1000000 Minor Status=0xe3000205-Inaccessible read, [Teradata][ODBC Teradata Driver] Major Status=0x1000000 Minor Status=0xe3000205-A name is required but was passed as NULL., [Teradata][ODBC Teradata Driver] Unable to logon with Authentication Mechanism selected.')

Teradata Employee

Re: Teradata Python Module

would someone please let me what i did wrong here? here is the script:

--

import teradata

with udaExec.connect(method="odbc", system="elm", username="dbc", password='dbc') as test_con:

--

NameError: name 'udaExec' is not defined

--

i have ran "pip install teradata", and odbc driver was installed too