For learning purpose, I am trying to fetch table list from Teradata in Python with the following code:
import jaydebeapi
import pandas as pd
try:
conn = jaydebeapi.connect(jclassname='com.teradata.jdbc.TeraDriver',
url="jdbc:teradata://10.10.10.10",
driver_args=['@user','@pss'],
jars=['/mnt/TERADATA/tdgssconfig.jar','/mnt/TERADATA/terajdbc4.jar'])
print("Connection was successful")
except Exception as e:
print(e)
#df = pd.read_sql_query('SELECT Databasename,TableName FROM dbc.tables WHERE tablekind = \'T\'',conn)
dfr = pd.DataFrame(df)
print(dfr.head(3))
The above works fine but when I try to fetch the table list based on a Database name then things are not working:
df = pd.read_sql_query('SELECT Databasename,TableName FROM dbc.tables WHERE tablekind = \'T\' and DatabaseName ='SALES'',conn)
dfr = pd.DataFrame(df)
print(dfr.head(3))
getting:
Error: Invalid Syntax
It has been couple of hours trying to figure it out but not able to get through it. Its very stupid to ask this but please advice where am I going wrong.
Ref: https://forgetcode.com/Teradata/1433-To-get-all-the-tables