Skip to Content
Previous

Getting Started with Predictive Analytics

By Adrian Plata

This tutorial series will cover two approaches to a sample project utilizing the predictive analytics capabilities of SAP HANA, express edition. This tutorial will show you how to configure your installation for the sample projects by creating a tenant database and a new user to manage that database.

You will learn

How to prepare your SAP HANA, express edition installation for Predictive Analytics.

Details


Step 1: Ensure AFL is Installed

Log in to your system database and select your database. Click on the Administration icon Administration Icon and under the Overview tab, next to Installed Plug-ins check that AFL is installed.

Overview Tab

Open an SQL command line to your database and check again that AFL PAL Functions are installed.

SELECT * FROM SYS.AFL_FUNCTIONS WHERE PACKAGE_NAME='PAL';

If a list of AFL functions is generated, AFL PAL Functions are installed.

Step 2: Create a Tenant Database and Activate the Script Server

Through your SQL command line, create a new tenant database.

CREATE DATABASE <DATABASE_NAME> SYSTEM USER PASSWORD <password>;

Example:

CREATE DATABASE AFL_TEST SYSTEM USER PASSWORD Password1;

Activate script server on your new tenant database.

ALTER DATABASE <DATABASE_NAME> ADD 'scriptserver';
Step 3: Connect to Your Tenant Database

Click on the Add System… icon Add System.

Add the Host Name, Instance Number, Mode, and Description for your tenant database.

  • The Host Name and Instance Number are the same as your System database.

  • For Mode, when you select Multiple containers select Tenant database and enter the name of your tenant database.

  • Click Next >.

Choose Authentication by database user and add the SYSTEM user with your tenant SYSTEM user password.

Click Finish.

Step 4: Download and Import the PAL Schema Sample Data

Open your preferred web browser and visit the SAP HANA Academy GitHub page and download the PAL21.zip file. Extract the PAL21.zip onto your local machine.

On SAP HANA Studio, select File > Import…

Under the SAP HANA folder, select Catalog Objects. Click Next >.

Import PAL20

Select your tenant database.

Select Import catalog objects from current client and select the directory where you extracted PAL21.zip. It will read PAL21.

Import Location

For Select Catalog Objects for Import, select and Add all of the objects from the PAL21 directory.

Click Next >.

Click Finish to begin your upload.

Importing the data will take some time.

Note:
You can check if the upload was successful by logging into your tenant database and cascading down from Catalog -> PAL -> Tables. You will see a series of tables.
PAL Tables

Step 5: Add a New User and Grant Proper Permissions for the Tenant Database

Open an SQL command line to your tenant database.

Create a new user:

CREATE USER <NEW_USER> PASSWORD <password>;

Example:

CREATE USER DEVUSER PASSWORD Password1;

Note:
The script in the following tutorial assumes your new username is DEVUSER. Consider naming your new user DEVUSER to avoid additional steps.

Authorize creation, removal, and execution of PAL Procedures:

GRANT AFLPM_CREATOR_ERASER_EXECUTE, AFL__SYS_AFL_AFLPAL_EXECUTE TO <NEW_USER>;

Enable modeling:

GRANT MODELING TO <NEW_USER>;

Enable Native Development:

GRANT EXECUTE ON REPOSITORY_REST TO <NEW_USER>;
GRANT REPO.READ, REPO.EDIT_NATIVE_OBJECTS, REPO.ACTIVATE_NATIVE_OBJECTS, REPO.MAINTAIN_NATIVE_PACKAGES ON ".REPO_PACKAGE_ROOT" TO <NEW_USER>;

Grant access to the sample data:

GRANT SELECT ON SCHEMA PAL TO <NEW_USER>;
GRANT SELECT ON SCHEMA PAL TO _SYS_REPO;
Step 6: Log in to the Tenant Database with the New User

Right-click on your tenant database. Select Add System with Different User….

Add New User

Add your new user and input its password.

Add User Info

Click Finish.

Note
You may be asked to give your new user a new password.

Step 7: Grant Access to New User Schema

Open an SQL command line to your tenant database through your new user and enter the following:

GRANT SELECT, INSERT, DELETE ON SCHEMA <NEW_USER> TO _SYS_REPO;

Next Steps

Updated 12/12/2017

Time to Complete

15 Min

Beginner

Tags

Next Steps

Next
Back to top