Hello All,
I am trying to develop a new decision on SAS VIYA ID interface. There are several database tables on teredata. This tables inculudes the some available offers for each customers and I have to assign one offers to one customer randomly. This campaing works weekly. The first 3 offers can not given as new offer to customer next week. How I do that case on ID? How I will made a connection with database? Must it be on python file this all process including connection to db, conditions etc. ? I really appriciated if you guide me.
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
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.