How My PALS Have Changed
“Alright pal” was the mode of address delivered when walking past someone you didn’t know in the neighbourhood where I grew up. It was said coldly, challengingly and accompanied by a piercing stare. Words have resonance and meaning which rarely change over time. However, in the current age where everything is shortened and abbreviated. PAL has come to mean a lot of things. In the 1990s PAL to me was the setting needed for the TV in the UK. Now it has become synonymous with the Predictive Analytics Library which in my mind means “a little bit of code” and a friendly “Hi, my name is Philip Mugglestone”. Today I am reviewing the capabilities of PAL in SPS09 so brilliantly explained in the video below by the SAP HANA Academy’s Philip Mugglestone. Like Bob, Philip has a confident , easy going yet professional intonation to his voice which puts you at ease and gives you the confidence to look at his “little bit of code” and follow his work. He makes it sounds straight forward and I enjoy listening to how he explains what he is doing.
As mentioned previously this video this part of a series covering the predictive capabilities native to SAP HANA. In this video you get started using the predictive analysis library with recently released SPS09 for SAP HANA. There have been a few technical improvements which impact on all the different algorithms.
The video assumes that you have:
- A clean install (vanilla) of SAP HANA SPS09 and you have access to the system user.
- Ensured that AFL (Application Function Library) has been installed.
- Set up and security to make sure that the user can actually use PAL. These settings have changed SPS09.
Check AFL Has Been Installed
Using the code below connect as system user to the database and run a select statement to check that PAL has been installed.
You get a number of rows back showing PAL is available. For example, Kord which is a new algorithm in SPS09.
If you run this query and you get nothing back for PAL then AFL probably hasn’t been installed. This is something you need to tell you to your system administrator about. You can install it either when you install SAP HANA or after using Life Cycle Management.
Ensure That The Script Server Has Been Started
When you want to work with the PAL you need to make sure that the scripts server for SAP HANA which is a process has been started. This has been the case right back from the beginning when working with SAP HANA.
If you want to check as a system user you can go to Administration and in the Configuration tab you should be able to see that for the damon.ini, script server, the instance is set to one which is green so it’s actually running. This does not start automatically by default in SAP HANA.
Again if you look at the Landscape tab you will see the script server running.
However, if using the SAP HANA Developer Edition it’s quite possible that this has already been done.
Authorizations Have Changed In SPS09
The authorizations you need to use PAL have changed and the method used to create and remove stored procedures using the wrapper has also changed.
IT IS NOT RECOMMENDED TO USE THE SYSTEM USER WHEN WORKING WITH PAL
This user is just for initial setup in and core admin tasks. It’s much better to create specific development or other end users to do specific tasks. It’s good practise to create a Developer user and the convention followed here is to call that user DEV_USER.
You can do this in code as above or using the interface as below.
You can see below once created you are logged in as the DEV_USER.
This means you can start giving the DEV_USER the right authorizations. There are two ways you can do this task. You can either do it through SQL script as below or through the user definition screen. There is a new role (highlighted below) that has been a made available with SPS09 which allows you to use the creation and removal of stored procedures. You need to make sure that anyone that’s going to be using the PAL has this role assigned to them.
It’s necessary if you want to run procedures to have another role which has been around for a while which is again highlighted below.
You also need to make sure that DEV_USER has read access to the schema you are using.
The authorizations the DEV_USER needs are summarised below.
Under object privileges you only need read access to the schemas you need to use.
The privileges that are new with SPS09 are the create and drop ones highlighted below. These belong to the SYS user.
The top two privileges are legacy ones from earlier versions of HANA but in SPS09 they are deprecated. Previous code will still run and you will still be able to work with it. The tutorial then shows example code from earlier in the series that you could use.
The difference in SPS09 is that when you want to create a stored procedure you’re not calling the system procedure you’re calling SYS as shown below.
Note the parameters that you specify have changed. However, in SPS09 you can specify which schema this procedure is going to be created in. This means when creating the table types you need to specify the schema where they belong.
The tutorial goes through how to use the code above before concluding by demonstrating where you can get help with PAL SPS09 as shown below.
All right PAL
Funnily enough for me the meaning of a pal or PAL has come full circle. It used to mean casual associate. Then it was a hardware setting on a television. Ironically my association with the word PAL is now closer to its actual meaning now than it was back in the day. A pal is a companion or comrade. Someone with whom you are intimate or familiar. So to make a pal you need to know the person. Pals learn about each other using social cues and signals. Likewise the Predictive Analytics Library (PAL) needs to have some data to operate. The defining characteristic of Predictive Analytics enables you to not only to predict the future behaviour but also to influence it. We all know pals we can influence and even predict what they would do in certain situations. We base these judgments on data gathered about their characteristics or past behaviour. Using PAL algorithms you can become closer to your customer . They become your pals. Handle your customer right and they will be loyal. The Predictive Analytics Library provided by SAP HANA in SPS09 continues to help you build relationships. It helps you turn casual customers into regular customers who want to know you well. Now, that’s more like a pal than those guys who you used to walk past me, back in the day.