Exporting a Single R Extension as a Stored Procedure

You can export a single R Extension as a stored procedure from Expert Analytics to SAP HANA. After which, any SAP HANA user can consume those models for analysis.

  • You must have a single R Extension created and saved in Expert Analytics.
  • Before exporting a model as a stored procedure, ensure that your account is defined in SAP HANA.

To export an R Extension as a stored procedure, take the following steps.

  1. Go to Start of the navigation path Predict Next navigation step Components List Next navigation step Models Next navigation step R Extensions End of the navigation path and select an existing R Extension for export.
  2. Click Export Model.
  3. Select Use this option to export a 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. Select Export.

You have exported a single R Extension to SAP HANA. On calling the procedure, the result grid consists of the features that you selected to train your model on, plus all predicted columns.

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.

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.