1

I'm trying to connect to Teradata using sqlalchemy as have to read sql using read_sql().

Code:

import pandas as pd
import numpy as np
import sqlalchemy 
import teradata
import sqlalchemy_teradata 

link = f'teradata://{username}:{password}@{hostname}/?logmech=LDAP'

connect = sqlalchemy.create_engine(link)

query_1 = "drop table TMP_WORK_DB.test1"
query_1_df = pd.read_sql(query_1, connect)

Error:

teradata.api.DatabaseError: (439, "[08001] [Teradata][socket error] (439) WSA E HostUnreach: The Teradata server can't currently be reached over this network, [Teradata][ODBC Teradata Driver] (27) Failed to log on.")

I have installed Teradata Database ODBC Driver 16.2.

Please help me with the same. Thanks in advance.

Aditi
  • 31
  • 5
  • For new development, better to use `teradatasqlalchemy` package and `teradatasql` dialect rather than `sqlalchemy_teradata` and `teradata` respectively. But this is a generic error saying that the network stack could not identify a route from your client machine to the IP to which the hostname resolved, not anything directly related to the driver being used. – Fred Feb 09 '22 at 15:30
  • Thanks for your response. Do you have any idea how can I resolve this error? – Aditi Feb 10 '22 at 05:54
  • Use nslookup or ping at a command prompt to see what IP address is being used. Note that if you specify XYZ or XYZ.mydomain.com as hostname the driver first tries to resolve XYZcop1 or XYZcop1.mydomain.com and if that fails it tries again with the actual name you supplied. Or try specifying the numeric IP address for the connection instead of a name, just as a test. You need to be able to reach port 25 on the Teradata node from your client. It seems either the address is wrong or there is a firewall or other network restriction preventing the connection. – Fred Feb 10 '22 at 14:59

0 Answers0