I am unable to achieve teradata connectivity using python with below sample script -
import teradata
import os, sys
os.environ["ODBCINI"] ="/opt/teradata/client/16.20/odbc_64/odbc.ini"
os.environ["ODBCINST"] ="/opt/teradata/client/16.20/odbc_64/odbcinst.ini"
os.environ["LD_LIBRARY_PATH"] ="/opt/teradata/client/16.20/odbc_64/lib"
udaExec = teradata.UdaExec (appName="HelloWorld", version="1.0", odbcLibPath="/opt/teradata/client/16.20/odbc_64/lib/tdataodbc_sb64.so")
session = udaExec.connect(method="odbc", system="tdprod", username="xxxxx", password="yyyyy")
for row in session.execute("SELECT GetQueryBand();"):
print(row)
Below is error log:
[servername@python]$ python test_teradata.py
Traceback (most recent call last):
File "test_teradata.py", line 17, in
session = udaExec.connect(method="odbc", system="tdprod", username="xxxxx", password="yyyyy")
File "/.../.../anaconda/lib/python2.7/site-packages/teradata/udaexec.py", line 183, in connect
**args))
File "/.../.../anaconda/lib/python2.7/site-packages/teradata/tdodbc.py", line 421, in initinit(odbcLibPath)
File "/.../.../anaconda/lib/python2.7/site-packages/teradata/tdodbc.py", line 367, in init initFunctionPrototypes()
File "/.../.../anaconda/lib/python2.7/site-packages/teradata/tdodbc.py", line 298, in initFunctionPrototypes prototype(odbc.SQLDrivers, SQLHANDLE, SQLUSMALLINT, PTR(SQLCHAR),
File "/.../.../anaconda/lib/python2.7/ctypes/init.py", line 375, in getattrfunc = self.getitem(name)
File "/.../.../anaconda/lib/python2.7/ctypes/init.py", line 380,in getitemfunc = self._FuncPtr((name_or_ordinal, self))
AttributeError: /opt/teradata/client/16.20/odbc_64/lib/tdataodbc_sb64.so: undefined symbol: SQLDrivers
I am unable to achieve teradata connectivity using python with below sample script - import teradata import os, sys os.environ["ODBCINI"] ="/opt/teradata/client/16.20/odbc_64/odbc.ini" os.environ["ODBCINST"] ="/opt/teradata/client/16.20/odbc_64/odbcinst.ini" os.environ["LD_LIBRARY_PATH"] ="/opt/teradata/client/16.20/odbc_64/lib"
udaExec = teradata.UdaExec (appName="HelloWorld", version="1.0", odbcLibPath="/opt/teradata/client/16.20/odbc_64/lib/tdataodbc_sb64.so") session = udaExec.connect(method="odbc", system="tdprod", username="xxxxx", password="yyyyy") for row in session.execute("SELECT GetQueryBand();"): print(row)
Below is error log: [servername@python]$ python test_teradata.py Traceback (most recent call last): File "test_teradata.py", line 17, in
session = udaExec.connect(method="odbc", system="tdprod", username="xxxxx", password="yyyyy")
File "/.../.../anaconda/lib/python2.7/site-packages/teradata/udaexec.py", line 183, in connect
**args))
File "/.../.../anaconda/lib/python2.7/site-packages/teradata/tdodbc.py", line 421, in initinit(odbcLibPath)
File "/.../.../anaconda/lib/python2.7/site-packages/teradata/tdodbc.py", line 367, in init initFunctionPrototypes()
File "/.../.../anaconda/lib/python2.7/site-packages/teradata/tdodbc.py", line 298, in initFunctionPrototypes prototype(odbc.SQLDrivers, SQLHANDLE, SQLUSMALLINT, PTR(SQLCHAR),
File "/.../.../anaconda/lib/python2.7/ctypes/init.py", line 375, in getattrfunc = self.getitem(name)
File "/.../.../anaconda/lib/python2.7/ctypes/init.py", line 380,in getitemfunc = self._FuncPtr((name_or_ordinal, self))
AttributeError: /opt/teradata/client/16.20/odbc_64/lib/tdataodbc_sb64.so: undefined symbol: SQLDrivers