Skip to Content
Author's profile photo Former Member

Exporting & Consuming PA created PAL predictive model in HANA

With SAP PA 1.0.11, it is possible to export created predictive model as HANA Stored procedure. This makes the created predictive models consumable from applications on HANA without having to go to PA to “score” the model. This article explains how you can do that.

1. Acquire the data using PA & train a predictive model using an algorithm. I am using below HANA C4.5 on the results of HANA K-Means.


2. Now, right click on the HANA C 4.5 (or any component in your analysis which generates the model and chose “Save the Model” option.


3. Now, go to “Saved Models” tab and right click on model that was saved in Step 2 and select “SAP HANA Stored Procedure” option.


4. Provide the schema in which the model needs to be stored and also name of the procedure & click on Finish to export the model.

P.S: Don’t have spaces or special characters in the name of the procedure


6. Now login to HANA Studio and see the model in the Catalog->Procedures section in the Modeler perspective.

7. Open the procedure by double clicking it and see the parameters.


8. See the SQL statements that made the procedure and closely observe the sections which are commented. PA provides the statements to manage lifecycle management of the procedure. If you take the commented portion of the statements and run it in the Studio, you would be able to drop all the objects related to the procedure.


9. Now, let us see how you can invoke this procedure from an application (in this case Studio) to score the model on a new set of data.

10. Open a SQL console and create a new table to hold the results.


11. Now, call the procedure to score the model on the table “NewStores” which contains unseen data.


12.  View the newly created table contents in the studio using the preview option.


13. This way, you can score the PA created PAL model from any application.

For the detailed list of new features in PA 1.0.11, refer to the blog here:

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Kurt Holst
      Kurt Holst

      Hi Vishwa.,

      Awesome, thanks for sharing.

      Excellent description.

      Best regards,

      Kurt Holst

      Author's profile photo Former Member
      Former Member

      This is a nice write up. I would like to see an easier way to compare the results of what PA produces for a model against the results of calling the stored procedure against the same data. Using the Multiple Linear Regression model for instance produces an output table that can't be easily, in my opinion, mapped back to the rows of the data used to produce the predicted values. PA surprisingly does not allow you to sort result tables based on columns or via filters, so it is hard to tell what the correct query is to fill a temporary table to pass into the exported stored procedure.

      Also, another question. Doing various tasks in Predictive Analysis, such as visualizing results produces all sorts of views, tables, etc. Is there an easy way to clean up after PA?

      Author's profile photo Former Member
      Former Member

      Hi Vishwanath,

      thanks, that was exactly the kind of example I was looking for!