In SAS Intelligent Decisioning on the new SAS Viya, you can use Data Queries as part of your decision flow. A data query allows you to use SQL to return records from a database or SAS data set. Any decisions that involve a data query file can only be published to the SAS Micro Analytic Service (MAS). To query a database, you first need to configure MAS in order to interact with the database. Because SAS Viya has been containerized, the data query configuration has changed since I described it for the previous version in this article.
There are three main steps for configuring MAS to use data query files in SAS Intelligent Decisioning for the new SAS Viya. Note: You must have administrative privileges to configure MAS.
# Find pod name for MAS
kubectl -n NAMESPACE get pods | grep microanalytic
Currently, the only databases supported for data queries in the new SAS Viya are Oracle and Postgres.
In SAS Environment Manager, I edit the sas.microanalyticserviceservice.properties section and for the connectionstring property I enter the following:
driver=sql;conopts=(driver=postgres;catalog=mypg;uid=<username>;pwd=<password>;server=<server name>;port=5432;DB=<DB name>;schema=<schema name>)
Next, I restart the MAS service. After waiting a few minutes for the service to be fully up and running, I validate a data query in SAS Intelligent Decisioning for one of the tables in my Postgres database.
In my query above I refer to the custom catalog name mypg when referencing the table since my connection string has the schema associated with it.
Working with data query results has not changed since SAS Viya 3.5, so for more information refer to this previous article on that topic.
Thanks to my colleague, Mark Thomas, for his assistance in restarting MAS for the writing of this article.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.