尝试使用ODBC方法并使用下面的代码建立与Teradata的连接,但是它给出错误,例如“ teradata.api.DatabaseError:(0,'[I] [。检查是否已安装ODBC驱动程序和ODBCINI或ODBCINST环境变量已正确设置。')“
ODBCINI和ODBCINST路径设置为
ODBCINI = /opt/teradata/client/ODBC_64/odbc.ini ODBCINST = /opt/teradata/client/ODBC_64/odbcinst.ini
import teradata
import pandas as pd
host,username,password = 'xxxxx','xxxxx', 'xxxxx'
udaExec = teradata.UdaExec ("Teradata_ODBC_DSN")
with udaExec.connect(method="odbc",system=host, username=username,
password=password) as connect:
query = "SELECT 1;"
df = pd.read_sql(query,connect)
print(df.head())
udaexec.ini
# Application Configuration
[CONFIG]
appName=HelloWorld
version=0.1
logConsole=True
dataSourceName=Teradata_ODBC_DSN
table=DBC.DBCInfo
# Default Data Source Configuration
[DEFAULT]
method=odbc
charset=UTF8
authentication=LDAP
# Data Source Definition
[Teradata_ODBC_DSN]
system=hostname
username=xxxx
password=xxxx
我在哪里做错了或者它与ODBC驱动程序的配置有关的问题?