Hi, you can use that code I shared below. First of all, you should connect to DB and query to your caslib.
def execute():
'Output: customer_id'
import teradatasql
try:
conn = teradatasql.connect(
host='<host_name>',
user='<username>',
password='<password>',
database='<your_DB>'
)
cursor = conn.cursor()
cursor.execute("SELECT TOP 1 customer_id FROM <your_DB>.CUSTOMER")
row = cursor.fetchall()
cursor.close()
conn.close()
return row