Skip to Content
Author's profile photo Ian Henry

Using the APL samples provided with Predictive Analysis 2.0

Having shown you how to install the Automated Predictive Library (APL) link below

How to Install the Automated Predictive Library in SAP HANA

We can now look to use the samples provided with the APL.

I would advise copying the SQL samples locally from the APL source location, probably on the HANA box, but also available within the Predictive Analysis (PA) 2.0 download inside the SAPPAAPL2000_0.TGZ

APL SQL Samples.png

First you will need to setup a user or be granted the relevant right to your user.  If you look at the apl_admin.sql it contains all the relevant statements.

The user roles needed for this would be



There is one step not shown in the sample SQL, which is creating the APL_SAMPLES schema, this is straightforward such as

     create schema APL_SAMPLES;

There is secondary SQL file that your USER needs to which creates the Table Types.  This is all within the apl_create_table_types.sql

You should run this and check that it is successful.  These are currently user specific so any user that requires access to the APL would need to execute this.

The table types can be found in HANA Studio under Procedures

Table Types.png

If you created the schema you will already have SELECT permission on this APL_SAMPLES schema if not you need to request this.

The data now needs to be imported into the schema, this straight forward with HANA Studio.

Right click the schema APL_SAMPLES and choose import

Import into Schema v2.png

We can now browse to the server location where the APL was extracted to.

Import into Schema.png

Choose our sample data tables and import them.

Import Samples.png

The samples should now all be configured and available for use directly via SQL or using Predictive Analysis 2.0.

I came across an issue with the CENSUS data set and have attached a fix here.  When using the APL it supports INTEGER datatype but it does not support  TINYINT or SMALLINT, so if you are using PA 2.0 and not just the APL SQL scripts you will receive an error.

To fix this you can run the following SQL


ALTER TABLE CENSUS ALTER (“age” INTEGER, “education-num” INTEGER, “capital-loss” INTEGER, “hours-per-week” INTEGER, “class” INTEGER);

Let me know how you get on, next I aim to show how these samples can be used with PA 2.0

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.