Teradata / PyTd

A Python Module to make it easy to script powerful interactions with Teradata Database in a DevOps friendly way.
MIT License
108 stars 43 forks source link

teradata not recognizing installed drivers #92

Open cirgue opened 6 years ago

cirgue commented 6 years ago

I am trying to connect using the following code snippet:

    udaExec = teradata.UdaExec (appName="CVR", version="1.0",
    logConsole=True)
    with udaExec.connect(method="odbc", externalDSN='teradata_prod',
    username=usn, password=pwd) as con:
        cur = con.cursor()
        cur.execute(query)
        data = cur.fetchall()
        results = pandas.DataFrame(data)

This code returns the following error: teradata.api.InterfaceError: ('DRIVER_NOT_FOUND', "No driver found for 'Teradata'. Available drivers: ")

/home/[username]/.odbc.ini:

[ODBC Data Sources] teradata_prod=tdata.so

[teradata_prod] Driver=/opt/teradata/client/13.10/odbc_64/lib/tdata.so Description=Teradata prod database DBCName=[system ip] Database=DBC

Why is the dsn not being recognized?

DaveRoth commented 6 years ago

How is teradata_prod defined in your udaExec.ini file?

Dave


From: cirgue notifications@github.com Sent: Thursday, January 4, 2018 20:12 To: Teradata/PyTd Cc: Subscribed Subject: [Teradata/PyTd] teradata not recognizing installed drivers (#92)

I am trying to connect using the following code snippet:

udaExec = teradata.UdaExec (appName="CVR", version="1.0",
logConsole=True)
with udaExec.connect(method="odbc", externalDSN='teradata_prod',
username=usn, password=pwd) as con:
    cur = con.cursor()
    cur.execute(query)
    data = cur.fetchall()
    results = pandas.DataFrame(data)

This code returns the following error: teradata.api.InterfaceError: ('DRIVER_NOT_FOUND', "No driver found for 'Teradata'. Available drivers: ")

/home/[username]/.odbc.ini:

[ODBC Data Sources] teradata_prod=tdata.so

[teradata_prod] Driver=/opt/teradata/client/13.10/odbc_64/lib/tdata.so Description=Teradata prod database DBCName=bhpm1.bhdc.att.com Database=DBC

Why is the dsn not being recognized?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FTeradata%2FPyTd%2Fissues%2F92&data=02%7C01%7C%7C332ed1c475ef445ebe2b08d553d95f5a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636507115425252227&sdata=ejw0%2FGH1vIzBHcAupCUGIWKKnMrkL7l0NRbN3sWKA2A%3D&reserved=0, or mute the threadhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAHzkTkYkniMQ8FS0NSDYV8qP6IxFdPSwks5tHXb0gaJpZM4RT6eb&data=02%7C01%7C%7C332ed1c475ef445ebe2b08d553d95f5a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636507115425252227&sdata=6mIumu4eb60Rpt%2F3HKgsw39LLiFjskKqNoyUXBbTUDE%3D&reserved=0.

cirgue commented 6 years ago
[CONFIG]
appName=CVR
version=1
logConsole=False
dataSourceName=teradata_prod

# Default Data Source Configuration
[DEFAULT]
method=odbc
charset=UTF8

# Data Source Definition
[teradata_prod]
system=[system ip]
username=[usn]
password=[pwd]
cirgue commented 6 years ago

I also receive the same error when using the teradata dialect for sqlalchemy

DaveRoth commented 6 years ago

Only difference I can see is that I have the driver name specified in the udaExec.ini

[BEDW_Development] system=dsn_name driver=Teradata Database ODBC Driver 16.10 username=username password=password

DaveRoth commented 6 years ago

Oddly, it looks like the enhancement for issue #50 should have fixed this .

padhia commented 6 years ago

ODBC Driver Manager consults odbcinst.ini to figure out available drivers. You might want to try setting an environment variable like below and see if that helps.

export ODBCINST=/opt/teradata/client/ODBC_64/odbcinst.ini
dineshkumarPS commented 6 years ago

Hi i am using teradata 15.0.1 when i try to run the python code i getting the error below i mention can anyone help to solve this error.

DatabaseError: [HY000] [Teradata][ODBC Teradata Driver] Loading the Teradata ICU Library Failed. Error is: 126, The driver returned invalid (or failed to return) SQL_DRIVER_ODBC_VER: 03.80

DaveRoth commented 6 years ago

dineshkumarPS Whenere you get ICU or GSS errors it is usually due to an incorrect odbc installation. Try reinstalling again

DaveRoth commented 6 years ago

cirgue did specifying the driver = or using the export command fix your issue?

jameswang2015 commented 5 years ago

Hi, I run the following code: `import teradata udaExec = teradata.UdaExec (appName="HelloWorld", version="1.0", logConsole=False)

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

and get this error: InterfaceError: ('DRIVER_NOT_FOUND', "No driver found for 'Teradata'. Available drivers: SQL Server,Oracle in n112064,MySQL ODBC 5.3 Driver (ToadDataPoint4.3),Adaptive Server Enterprise (Toad Data Point 4.3),SQL Anywhere (Toad Data Point 4.3),IQ (Toad Data Point 4.3),SAP HANA (Toad Data Point 4.3)")

I can use TOAD and LDAP driver to connect to this database, and I have the driver files (LDAP.ORA and SQLNET.ORA) in hand. I already pip install Teradata by following the instruction. Do I need to install LDAP driver? or where should I put these two driver file to make it work for this module? Should I change method to LDAP instead of ODBC within UdaExec? Thanks

jameswang2015 commented 5 years ago

This has been resolved when I install the ODBC driver. Thanks.

HerculesGomez commented 4 years ago

I had issues when using anaconda. I installed python36 and it is working now on oracle linux.

This is all I have in my .bash_profile: export ODBCINI=/opt/teradata/client/ODBC_64/odbc.ini

And then the contents of /opt/teradata/client/ODBC_64/odbc.ini are: [ODBC Drivers] Teradata Database ODBC Driver 16.20=Installed

[Teradata Database ODBC Driver 16.20] Description=Teradata Database ODBC Driver 16.20 Driver=/opt/teradata/client/ODBC_64/lib/tdataodbc_sb64.so CPTimeout=60

[ODBC] InstallDir=/opt/teradata/client/ODBC_64 Trace=no Pooling=yes

[ODBC Data Sources] Teradata ODBC DSN=Teradata Database ODBC Driver 16.20

[TDP6] Description=Teradata Database ODBC Driver 16.20

Driver: The location where the ODBC driver is installed to.

Driver=/opt/teradata/client/ODBC_64/lib/tdataodbc_sb64.so

Required: These values can also be specified in the connection string.

DBCName1= UID= PWD=

Hope this helps!