I am using teradatasql
to connect DB and get the table definition. Below is my code which returns the definition for table. Here I trying find any default function which returns the colum_name and data_type of table as a separate function.
with teradatasql.connect ('{"host":"whomooz","user":"guest","password":"please"}') as con:
with con.cursor () as cur:
try:
sRequest = "show table MYTABLE"
print(sRequest)
cur.execute(sRequest)
[print(row) for row in sorted(cur.fetchall())]
except Exception as ex:
print("Ignoring", str(ex).split("\n")[0])
here I am looking for any inbuilt function which can return column_name
and data_type
.
output should be like
customer_name VARCHAR
address VARCHAR
type SMALLINT
I looked at the teradatasql docs but did not find any reference