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
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.