Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Teradata Python module to login into environment using LDAP?

I'm writing a script to run a series of queries from a database and do some analysis on the data returned using the Teradata Python Module.

The environment I want to access uses LDAP authentication. Does anyone have any guidance on what I need to do to my script to access that environment?

I'm currently getting the error:

teradata.api.DatabaseError: (8017, '[28000] [Teradata][ODBC Teradata Driver][Teradata Database] The UserId, Password or Account is invalid. ')

However I can log into Teradata with my credentials so I'm not sure what I'm messing up on my UdaExec files...

like image 219
user2023068 Avatar asked Jul 26 '26 21:07

user2023068


1 Answers

If you are using the Teradata Python module with ODBC driver to connect to Teradata, you can use LDAP authentication by specifying the option authentication=LDAP in the connect method. I have seen this to work with Teradata Database ODBC Driver 16.10 and should mostly work in ODBC Driver version 15.10 as well (not tested).

Example:

import teradata

udaExec = teradata.UdaExec(appName="MyApp", version="1.0", logConsole=True)

session = udaExec.connect(method="odbc", system="<TD-SERVER>", username="<LDAP-USER>", password="<LDAP-PASSWD>", authentication="LDAP")

for row in session.execute("SELECT GetQueryBand()"):
    print(row)
like image 50
Saurav Haloi Avatar answered Jul 28 '26 10:07

Saurav Haloi