Exporting a Single SAP HANA Model as a Stored Procedure

You can export an SAP HANA model as a stored procedure to SAP HANA database. Any SAP HANA user can consume those models for analysis.

  • You must have a model created and saved in the list of components under Models.
  • Before exporting an SAP HANA model as a stored procedure, ensure that your account is defined in SAP HANA.
Note

You can export models that contain SAP Automated Predictive Library (APL) or custom Predictive Analysis Library (PAL) components.

  1. In the Predict room, from the list of components on the right, choose Models.
  2. Select the required model and from the Component Actions section, choose Export Model.
  3. Select Use this option to export an SAP HANA Model as a stored procedure.
  4. Click Export.
  5. Select the required schema under which you want the procedure to appear in SAP HANA.
  6. Specify a procedure name.
    Note If you want to overwrite an existing procedure with the same name in the selected schema, select Overwrite, if exists.
  7. Choose Export.

This functionality exports the single model that you have selected as a stored procedure, as opposed to the entire analysis chain. The exported stored procedure and associated objects (tables, types) appear under the selected schema in the SAP HANA database. You can consume a stored procedure for use outside of Expert Analytics.

Tip The following is an example call on an exported stored procedure in SAP HANA:
CREATE TABLE InputData like PAS00AMYWGCT0Y_ZE4LISJ2MWSCOREPROCEDURE_INPUT_TYPE;

--- Insert the data that you would like to score on into the InputData table:

CREATE TABLE ResultTable like PAS00AMYWGCT0Y_ZE4LISJ2MWSCOREPROCEDURE_OUTPUT_TYPE;

call "ANALYTICS"."ScoreProcedure"(InputData,ResultTable) WITH OVERVIEW;

select * from ResultTable;
Where the following entities should be replaced with your own:
  • PAS00AMYWGCT0Y_ZE4LISJ2MWSCOREPROCEDURE_INPUT_TYPE: The table type that defines the input columns of the exported stored procedure. It contains all feature columns that you used to train your model.

  • PAS00AMYWGCT0Y_ZE4LISJ2MWSCOREPROCEDURE_OUTPUT_TYPE: The table type that defines the output columns of the exported stored procedure. It contains all feature columns that you used to train your model, plus the columns that your stored procedure generates.

  • ANALYTICS: The schema name to which you exported your stored procedure.