SAP HANA External Machine Learning Library Guide en
SAP HANA External Machine Learning Library Guide en
2 Getting Started. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1 Prerequisites. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
5 CloudHook. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
SAP HANA External Machine Learning Library for SAP HANA Platform
2 PUBLIC Content
1 SAP HANA External Machine Learning
Library
This guide describes how to integrate an external machine learning framework, Google TensorFlow, with SAP
HANA.
The integration of Google TensorFlow with SAP HANA is based on the SAP HANA Application Function Library
(AFL) as well as Google’s gRPC remote procedure call package. It also involves a separate server process that
hosts the actual machine learning functionality.
● Getting Started
This section describes the basic requirements for using the External Machine Learning (EML) Library, the
main components it involves, the technical architecture, the supported deployment scenarios, and the
users and authorizations needed.
It also describes how to verify that the EML objects were successfully installed and introduces the general
syntax for calling EML procedures.
● Models and Call Signatures
This section introduces the main concepts associated with TensorFlow machine learning models, such as
signatures, tensors, shapes, and data types. It explains how input and output tensors on the TensorFlow
side are mapped to SAP HANA columns and tables and how the TensorFlow model can be called from SAP
HANA using the PREDICT or PREDICTM procedure.
● Deploying and Mapping Models on a Landscape
This section explains how to deploy a model in a TensorFlow ModelServer (TMS), how to create a remote
source in SAP HANA to contact the remote TMS, and how to map the model in the TMS to the remote
source.
It also describes how to update the model and landscape definitions and how to validate them, that is,
verify that a given model can be reached and has a valid serving state.
● CloudHook
This topic describes how the CLOUDHOOK functions can be used to integrate external services such as
SAP Data Hub or external cloud providers.
SAP HANA External Machine Learning Library for SAP HANA Platform
SAP HANA External Machine Learning Library PUBLIC 3
2 Getting Started
Familiarize yourself with the External Machine Learning (EML) Library and its specific requirements.
Related Information
Prerequisites [page 4]
Components [page 5]
Technical Architecture [page 6]
Deployment Scenarios [page 7]
Users and Roles [page 7]
2.1 Prerequisites
To use the SAP HANA External Machine Learning (EML) features, you need to do the following:
Note
The revision number of the SAP HANA EML AFL must match the revision number of SAP HANA. For
more information, see SAP Note 1898497.
● Enable the Script Server on the SAP HANA instance. For more information, see SAP Note 1650957.
Related Information
SAP HANA External Machine Learning Library for SAP HANA Platform
4 PUBLIC Getting Started
2.2 Components
The main components involved in the integration between SAP HANA and Google TensorFlow are described
below.
TensorFlow
TensorFlow provides a set of open-source machine-learning libraries together with a supporting infrastructure
that allows you to experiment with a wide range of machine learning algorithms. You can execute the
algorithms efficiently across different types of hardware environments, ranging from mobile phones to
distributed clusters of servers, with additional GPUs.
As a data scientist, you can use TensorFlow to create, train, and evaluate machine learning models. When you
are satisfied with the performance of the finalized model, you can prepare additional metadata and export the
model in the SavedModel format for consumption through TensorFlow Serving.
TensorFlow Serving is a flexible, high-performance serving system for machine learning models and is
designed for production environments. A TensorFlow ModelServer (TMS) makes TensorFlow models exported
in SavedModel format accessible for execution through the gRPC remote procedure call mechanism. An
effective SAP HANA EML AFL installation needs to have access to at least one running TMS in order to execute
TensorFlow calculations.
The recommended way to obtain and run the TMS is using Google’s official Docker images. For more
information, see TensorFlow Serving with Docker .
Alternatively, if your infrastructure does not support Docker images, the official TMS binaries can be used
instead. For more information, see Installation: Installing ModelServer .
SAP HANA External Machine Learning Library for SAP HANA Platform
Getting Started PUBLIC 5
External Machine Learning (EML) AFL
The EML AFL is a TensorFlow Serving client implementation for SAP HANA. It makes TensorFlow inferences on
models deployed in a TensorFlow ModelServer available as local AFL procedure calls in SAP HANA.
The basic architecture underlying the integration of Google TensorFlow with SAP HANA is shown below.
Component Description
EML AFL The TensorFlow Serving client implementation for SAP HANA. It allows
predefined TensorFlow models to be remotely invoked through gRPC
calls encapsulated inside AFL procedures.
TensorFlow ModelServer (TMS) Makes TensorFlow models exported in SavedModel format accessible for
execution through gRPC remote procedure calls
Active Models The models currently served and therefore available for execution
gRPC Server The gRPC server interface for communication with the TMS client
SAP HANA External Machine Learning Library for SAP HANA Platform
6 PUBLIC Getting Started
Component Description
Model Persistence Externally stored models in SavedModel format available for activation in
the TMS
Other Cloud Services and Infrastructure Includes, for example, SAP Data Hub and external cloud providers
The TensorFlow ModelServer (TMS) can be co-deployed on the SAP HANA landscape or deployed on separate
hardware resources.
You require the following users in the SAP HANA and TMS systems.
An EML administrator manages the system landscape by setting up and monitoring the connections to the
TMS servers hosting the models.
● MONITORING
● AFL__SYS_AFL_EML_EXECUTE
● CREATE REMOTE SOURCE
● SELECT ON _SYS_AFL.EML_MODEL_CONFIGURATION
● UPDATE ON _SYS_AFL.EML_MODEL_CONFIGURATION
● INSERT ON _SYS_AFL.EML_MODEL_CONFIGURATION
● DELETE ON _SYS_AFL.EML_MODEL_CONFIGURATION
SAP HANA External Machine Learning Library for SAP HANA Platform
Getting Started PUBLIC 7
SAP HANA EML User
An EML user, typically the application developer, defines which models are available and how they can be
invoked.
● AFL__SYS_AFL_EML_EXECUTE
Note that to use the previous versions of the EML PREDICT and PREDICTM functions that required wrapper
procedures to be generated, the AFLPM_CREATOR_ERASER_EXECUTE privilege is also required to create the
wrappers.
This is the operating system user that runs the TMS instances. There can be multiple operating system users
on all target landscapes. For best isolation, this user should be distinct from the SAP HANA system
administrator user.
To confirm that the EML functions were installed successfully, you can check the following public views:
● sys.afl_areas
● sys.afl_packages
● sys.afl_functions
These views are granted to the PUBLIC role and can be accessed by anyone.
The result will indicate whether the EML functions were successfully installed on your system.
SAP HANA External Machine Learning Library for SAP HANA Platform
8 PUBLIC Getting Started
To verify that the EML procedures were generated, open the _SYS_AFL schema in the SAP HANA Catalog, as
shown below:
SAP HANA External Machine Learning Library for SAP HANA Platform
Getting Started PUBLIC 9
2.7 Calling EML Procedures
After the installation of the SAP HANA Application Function Library (AFL), the generated EML procedures are
available in the _SYS_AFL schema. All EML procedure names start with EML_.
CALL _SYS_AFL.EML_<function_name>_PROC(
{input_table1,…}, <output_tab>) WITH OVERVIEW;
Sample Code
The EML PREDICT and PREDICTM procedures take a variable number of input tables. Unlike other SAP HANA
stored procedures, which are statically typed and require pre-defined input and output table signatures, the
EML PREDICT and PREDICTM procedures also allow you to pass input tables with different column structures.
The PREDICT and PREDICTM procedures are based on the PREDICT_ANY and PREDICTM_ANY functions.
CALL _SYS_AFL.EML_<procedure_name>(
{input_table1,…}, <output_table>) WITH OVERVIEW;
Sample Code
SAP HANA External Machine Learning Library for SAP HANA Platform
10 PUBLIC Getting Started
Note
The previous versions of the EML PREDICT and PREDICTM functions that required wrapper procedures to
be generated are still supported in existing code.
Related Information
SAP HANA External Machine Learning Library for SAP HANA Platform
Getting Started PUBLIC 11
3 Models and Call Signatures
A TensorFlow machine learning model implements the actual machine learning functionality (typically
inference), which involves mapping a set of input data to a set of output data (for example, images to textual
descriptions, historical data to predictions). The actual artifact representing such a model in the TensorFlow
Serving environment is a SavedModel.
TensorFlow models are created and trained by data scientists, typically in a Python-based programming and
training environment. The inner workings of the finished model are hidden within a SavedModel, while the
details of the inputs and outputs for using the model are exposed in the SavedModel signature.
All inputs and outputs of TensorFlow models are described in terms of tensors, which denote arrays of various
data types and dimensionality, referred to as the tensor's shape. Every TensorFlow model takes a number of
input tensors and transforms them into a number of output tensors. Since TensorFlow models are general
dataflow graphs, there may be multiple different inputs and outputs possible that make available different parts
of the overall transformation flow encapsulated in the model.
A SavedModel has a number of signatures, each describing one meaningful combination of input and output
tensors. Each SavedModel should have exactly one serving_default signature and can have an arbitrary
number of additional named signatures that provide alternative uses of the same graph.
The External Machine Learning AFL supports only a subset of TensorFlow's tensor shapes and data types,
namely those that can be relatively easily mapped between standard SQL tables and data types and tensors. Of
the possible combinations defined in the TensorFlow documentation Tensor Ranks, Shapes, and Types, the
following are supported in particular:
DT_STRING All string and BLOB data types Rank 1 and Rank 2
Related Information
SavedModel README
Module: tf.saved_model
Module: tf.saved_model.signature_def_utils
Tensor Ranks, Shapes, and Types
SAP HANA External Machine Learning Library for SAP HANA Platform
12 PUBLIC Models and Call Signatures
3.1 TensorFlow Model Example
This example shows a simple linear regression TensorFlow model that tries to fit a vector of input values to a
predict regressed output. The model has an input tensor named features and an output tensor named
results.
The signature is as follows (based on the saved_model_cli utility from TensorFlow r1.2.0 and higher):
The shapes (features and results are tensors of width 1 and indefinite length, indicated by the -1 value) fit
SAP HANA tables of the following shape:
Related Information
It is important to include complete signature information and, in particular, complete tensor shape information
using the utilities provided by TensorFlow (for example, tf.saved_model.utils.build_tensor_info).
If you have multiple input and output tensors, they are mapped to tables and columns in SAP HANA in the
order established by sorting their key values in the C locale. Although this might appear arbitrary, it needs to
be done because TensorFlow represents the tensors in a position-independent manner in a map keyed by
name, while in SAP HANA some of the relationships have to be represented by the relative position of the tables
and columns in the argument order. Note that tensor names and SAP HANA column and table names are
otherwise completely independent of each other.
SAP HANA External Machine Learning Library for SAP HANA Platform
Models and Call Signatures PUBLIC 13
The following example illustrates the mapping between tensor names and argument order. On the TensorFlow
side, the tensors are listed as follows:
signature_def['serving_default']:
The given SavedModel SignatureDef contains the following input(s):
inputs['second'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 1)
name: x1:0
inputs['first'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 1)
name: x2:0
The given SavedModel SignatureDef contains the following output(s):
outputs['y'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 1)
name: y:0
On the SAP HANA side, the "x2" tensor maps to the first input table and the "x1" tensor to the second input
table, despite being listed in the order shown above. This is because their key values sort in the order first - >
second.
Unlike input tensors, which are mapped one by one to separate input tables in the sorted order of their keys,
output tensors have a very limited set of types and shapes and are currently all combined into a single output
table. This means that output tensors must all have the same shape and can differ only in their data type.
Related Information
tf.saved_model.utils.build_tensor_info
Serving a TensorFlow Model
Once you have the information about the number, type, and positions of the model inputs and outputs at hand,
you can map this information to the required tables in SAP HANA and then invoke the TensorFlow model by
calling the PREDICT procedure provided by the EML AFL. The example below illustrates this process.
The example uses the simple linear regression model that is specified as follows:
SAP HANA External Machine Learning Library for SAP HANA Platform
14 PUBLIC Models and Call Signatures
1. Prepare the tables:
2. Invoke the TensorFlow model, in the same way as a normal AFL function:
-- The value for "Model" must match the name used by the TensorFlow
ModelServer.
CREATE TABLE CALL_PARAMS LIKE CALL_PARAMS_TT;
INSERT INTO CALL_PARAMS VALUES ('Model', 'linearregression');
CREATE TABLE FEATURES LIKE FEATURES_TT;
INSERT INTO FEATURES VALUES (1.1);
INSERT INTO FEATURES VALUES (2.5);
INSERT INTO FEATURES VALUES (2.9);
INSERT INTO FEATURES VALUES (8.9);
CREATE TABLE RESULTS LIKE RESULTS_TT;
-- Perform linear regression
CALL _SYS_AFL.EML_PREDICT(CALL_PARAMS, FEATURES, RESULTS) WITH OVERVIEW;
SELECT * FROM RESULTS;
Related Information
PREDICT(CALL_PARAMS,INPUT1, OUTPUT)
PREDICT_2(CALL_PARAMS,INPUT1,INPUT2, OUTPUT)
PREDICT_3(CALL_PARAMS,INPUT1,INPUT2,INPUT3, OUTPUT)
PREDICT_4(CALL_PARAMS,INPUT1, INPUT2, INPUT3, INPUT4, OUTPUT)
The EML AFL currently supports up to four INPUT tables, each of which can have an arbitrary number of
columns of FLOAT, DOUBLE, INTEGER, and various SAP HANA string and BLOB data types.
CALL_PARAMS
SAP HANA External Machine Learning Library for SAP HANA Platform
Models and Call Signatures PUBLIC 15
Parameter Value Mandatory Comment
Note
The keywords for the Parameter column (that is, "Model" and "Deadline") are case
sensitive.
INPUT
INPUT denotes the tables that match the input tensors of the specified signature of the
model according to the following mapping rules, in the order given by sorting the input
tensor keys in the C locale:
For PREDICT and any definite value of N (that is, not "-1", which means arbitrary),
PREDICT ignores rows beyond N. For PREDICTM, the number of rows under each tag
must match N exactly.
OUTPUT
The OUTPUT table has N rows of M columns matching M output tensors of shape (-1,N)
and appropriate data types.
To distinguish the different sets of inputs and results, each input table has an INTEGER "tag" column as its first
column. Spans of adjacent rows with the same INTEGER tag value are formatted into a separate inference call.
SAP HANA External Machine Learning Library for SAP HANA Platform
16 PUBLIC Models and Call Signatures
The results are tagged with the corresponding INTEGER tag in the output table’s "tag" column. The results in
the output table may appear in a different order than the input ranges, but they are guaranteed to be in
consecutive rows per partial result set. Where possible, calls are processed in parallel.
PREDICTM(CALL_PARAMS,INPUT1, OUTPUT)
PREDICTM_2(CALL_PARAMS,INPUT1,INPUT2, OUTPUT)
PREDICTM_3(CALL_PARAMS,INPUT1,INPUT2,INPUT3, OUTPUT)
PREDICTM_4(CALL_PARAMS,INPUT1, INPUT2, INPUT3, INPUT4, OUTPUT)
The semantics of CALL_PARAMS and OUTPUT are identical to PREDICT, with the exception of the first
additional "tag" column. So a parallel version involving multiple calls to the linear regression from the PREDICT
section looks like this (reusing CALL_PARAMS from the PREDICT example):
Note
In case of unrecoverable errors (either input formatting, remote processing, or result collection) in any
given tag subset, PREDICTM may partially fill the output table with results prior to the unrecoverable error.
SAP HANA External Machine Learning Library for SAP HANA Platform
Models and Call Signatures PUBLIC 17
4 Deploying and Mapping Models on a
Landscape
TensorFlow models you want to use need to be mapped to a system landscape that has at least one TensorFlow
ModelServer (TMS) hosting the models.
This task is performed by the system administrator and requires the appropriate roles and privileges. The
networking-related part of this mapping makes use of the remote source concept from the SAP HANA
federation framework, while the content part uses a system configuration table. All tasks are managed through
normal SQL commands on the configuration table and the CTL and CHECKDESTINATION procedures.
Related Information
A SavedModel is a directory tree containing a defined structure of special files. For the purposes of
deployment, the saved model directory tree has to be copied to a file system location that can be reached by
the running TMS instance.
In order to use a model, you need to expose the model as a service using TensorFlow serving. You can load
multiple models into a TMS at the same time by using the model_config_file method, which allows you to
list the individual models that you want to add to the TMS in a configuration file.
Example: Serve the two example models "testmodel" and "anothermodel" on a single TMS
1. Ensure that you have the following model directory structure:
○ The SavedModel for testmodel is in the directory /models/testmodel_1.
○ The SavedModel for anothermodel is in the directory /models/testmodel_2.
2. Create a file called mymodelconfig.conf and add the models as follows:
model_config_list: {
config: {
name: "testmodel",
base_path: "/models/testmodel_1",
model_platform: "tensorflow"
},
SAP HANA External Machine Learning Library for SAP HANA Platform
18 PUBLIC Deploying and Mapping Models on a Landscape
config: {
name: "anothermodel",
base_path: "/models/testmodel_2",
model_platform: "tensorflow"
}
}
Note
○ Using Docker:
1. Copy mymodelconfig.conf to /models/mymodelconfig.conf.
2. Run the following:
○ Directly:
On the TMS host, invoke the tensorflow_model_server with the following command:
Note that the file paths do not have to be absolute. Relative file paths are interpreted relative to the
working directory of the TMS.
For the full set of arguments for the tensorflow_model_server, see the Google documentation.
Related Information
To contact a remote TMS or CloudHook server, SAP HANA needs network addresses, port numbers, and
optionally security-related information about the network transport to be established. Because Tensorflow
Serving is a protocol defined on top of gRPC, remote sources need to be defined on the grpc adapter.
Example
A TMS is deployed on a host reachable under the name tmsserver.mydomain.com, port number 5000.
The model testmodel is deployed to that TMS. The connection is unauthenticated and unencrypted. The
only transport setup currently understood by the TMS code as published by Google is as follows:
SAP HANA External Machine Learning Library for SAP HANA Platform
Deploying and Mapping Models on a Landscape PUBLIC 19
The full set of options for the grpc adapter is given below:
deadline How long to wait at most for Number of milliseconds be Maximum timeout is 10 mi
a response from the TMS tween 1 and 600000 nutes
client_crt Certificate X509 client certificate Only needed when the TMS
is set to certificate authenti
cation
client_key Private key X509 client private key Only needed when the TMS
is set to certificate authenti
cation
cloudhooktype Command vocabulary type of Simple valid identifier string Describes the type of com
the CloudHook server mand vocabulary and pur
pose of the CloudHook
server represented by the re
mote source
Note that it is not possible to enter the correct values for the client_crt, client_key, and ca fields in any of the
graphical interfaces to SAP HANA, because the certificates are either binary or have a defined multiline
encoding. The only way to create a remote source with these values is through a textual definition.
Example
Create a remote source to a TMS on the host tmshost behind the proxy proxy.corp:
SAP HANA External Machine Learning Library for SAP HANA Platform
20 PUBLIC Deploying and Mapping Models on a Landscape
Example
Create a remote source with encryption enabled. The TMS server keys have been signed with a private
Certification Authority that is not in the default trust list and therefore needs to be explicitly specified:
TABLE _SYS_AFL.EML_MODEL_CONFIGURATION (
"Model" VARCHAR(256),
"Parameter" VARCHAR(256),
"Value" VARCHAR(256)
);
Model
The name of the model as deployed in a given TMS. Model names must be unique
across the entire landscape and the underlying TensorFlow model must be the same
model on all TMS instances where it is deployed, otherwise the behavior is undefined.
SAP HANA External Machine Learning Library for SAP HANA Platform
Deploying and Mapping Models on a Landscape PUBLIC 21
Parameter and Value
An open extensible set of parameters that can be assigned to a given model. Currently
the only valid "Parameter" is RemoteSource , with a "Value" specifying the name of a
grpc remote source, as defined by the SAP HANA federation framework.
Note
The keywords for the Parameter column (that is, RemoteSource) are case
sensitive.
Example
The TMS is deployed on a host that can be reached through the TMS_1 remote source already defined in
the previous example. The model testmodel is deployed to that TMS. Insert the required values into the
EML model configuration table:
A single TMS can host multiple models and a single model can be hosted on multiple TMS instances. Typically,
it is better to deploy multiple models on a single TMS on a given host rather than deploying multiple TMS
instances on a single host with a single model in each TMS. In the latter case, this occupies multiple ports and
needlessly replicates the overhead of the underlying TensorFlow runtime in each TMS.
SYS_AFL.EML_CTL_PROC(Request,CALL_PARAMS,RESULTS)
Request
CALL_PARAMS
SAP HANA External Machine Learning Library for SAP HANA Platform
22 PUBLIC Deploying and Mapping Models on a Landscape
RESULTS
It is used to report the result of whatever action CTL has taken, by giving both the error
codes and long texts for the various items of a control request.
The only key for the UpdateModelConfiguration request is Status, with the error
code and error text shown in the Value and Text columns.
Example
Update the runtime in an SAP HANA system with a single index server/script server:
Update the runtime in an SAP HANA system with multiple index servers/script servers:
SAP HANA External Machine Learning Library for SAP HANA Platform
Deploying and Mapping Models on a Landscape PUBLIC 23
4.5 Validating Model and Landscape Definitions
The CHECKDESTINATION call allows you to validate that a given model or CloudHook server can be actively
called under a specified set of landscape definitions. It can be used to verify that the model or CloudHook is
reachable and, for models, that it has a valid serving state.
CALL_PARAMS
The "RemoteSource" parameter allows TMS hosts to be checked that have not yet been
deployed into the active runtime service. Actual model invocations through PREDICT-
style calls need to have a remote source defined in
SYS_AFL.EML_MODEL_CONFIGURATION.
Note
The keywords for the Parameter column (that is, "Model", "RemoteSource", and
"Deadline") are case sensitive.
Example
SAP HANA External Machine Learning Library for SAP HANA Platform
24 PUBLIC Deploying and Mapping Models on a Landscape
CALL _SYS_AFL.EML_CHECKDESTINATION_PROC(CALL_PARAMS,
RESULTS);
RESULTS
The return values in the RESULTS table after successful invocation (that is, the call to
CHECKDESTINATION was technically correct, but not necessarily the underlying
destination being checked) are as follows:
5 Server <destination> ok but no A TMS was found but did not have a
model <model> matching model. Check the TMS configu-
ration and the model name.
14 Server <destination> is alive The host was reached but no TMS, Cloud
but refused connection Hook, or proxy was found at the given
port number. Check the proxy or TMS/
CloudHook (depending on whether a
proxy is used).
SAP HANA External Machine Learning Library for SAP HANA Platform
Deploying and Mapping Models on a Landscape PUBLIC 25
5 CloudHook
The CLOUDHOOK functions allow generic external management functionality to be invoked using SQLScript.
They serve as a building block for integrating external services such as SAP Data Hub or external cloud
providers.
For this purpose, an intermediate CloudHook server is positioned between EML and the external services. The
management functionality itself is therefore not directly embedded in EML.
● CLOUDHOOK_COMMAND
● CLOUDHOOK_SENDBLOB
● CLOUDHOOK_GETBLOB
Each function has its own specific signature, but the parameters are identical.
Related Information
5.1 CLOUDHOOK_COMMAND
The CLOUDHOOK_COMMAND function can be used to manage externally stored models from within SAP
HANA. Typical use cases include listing stored models, deploying and undeploying models, listing active
models, and activating and deactivating model versions.
CLOUDHOOK_COMMAND_PROC(CALL_PARAMS,INPUT, OUTPUT)
CALL_PARAMS
SAP HANA External Machine Learning Library for SAP HANA Platform
26 PUBLIC CloudHook
Parameter Value Mandatory Comment
Note that the "Command" values "SendBlob" and "GetBlob" are reserved for the
CLOUDHOOK_SENDBLOB and CLOUDHOOK_GETBLOB functions.
INPUT
OUTPUT
Which "Tag" values are valid and whether they are mandatory, optional, unique, or can appear multiple times
depends on the "cloudhooktype".
5.2 CLOUDHOOK_SENDBLOB
The CLOUDHOOK_SENDBLOB function can be used to move large binary objects from BLOB columns in SAP
HANA to the CloudHook server. It has the reserved "Command" value "SendBlob".
CLOUDHOOK_SENDBLOB_PROC(CALL_PARAMS,INPUT, OUTPUT)
CALL_PARAMS
SAP HANA External Machine Learning Library for SAP HANA Platform
CloudHook PUBLIC 27
Parameter Value Mandatory Comment
INPUT
OUTPUT
1. For every "Tag"/"Value" pair in "INPUT", the contents of "Value" are sent to the remote CloudHook server.
2. The remote CloudHook server stores the values and returns a string handle in "OUTPUT" under the same
"Tag".
For example:
"Tag" "Value"
"SavedModel" "a7f8f184-81dd-4495-8169-d1b9434f5ba4"
SAP HANA External Machine Learning Library for SAP HANA Platform
28 PUBLIC CloudHook
5.3 CLOUDHOOK_GETBLOB
The CLOUDHOOK_GETBLOB function can be used to move large binary objects from the CloudHook server to
BLOB columns in SAP HANA. It has the reserved "Command" value "GetBlob".
CLOUDHOOK_GETBLOB_PROC(CALL_PARAMS,INPUT, OUTPUT)
CALL_PARAMS
INPUT
OUTPUT
1. For every "Tag"/"Value" pair in "INPUT", the contents are requested from the remote CloudHook server.
2. The remote CloudHook server retrieves the contents and places them in "OUTPUT" under the same "Tag".
For example:
SAP HANA External Machine Learning Library for SAP HANA Platform
CloudHook PUBLIC 29
CREATE TYPE CH_ARG_OUTPUT_TT AS TABLE ("Tag" VARCHAR(100), "Value" BLOB);
CREATE TABLE CH_PARAMS LIKE CH_PARAMS_TT;
CREATE TABLE CH_INPUT LIKE CH_ARG_INPUT_TT;
CREATE TABLE CH_OUTPUT LIKE CH_ARG__OUTPUT_TT;
INSERT INTO CH_PARAMS VALUES ('Command', 'GetBlob');
INSERT INTO CH_PARAMS VALUES ('RemoteSource', 'MYDOCKER');
DELETE FROM CH_INPUT;
INSERT INTO CH_INPUT VALUES('SavedModel', 'a7f8f184-81dd-4495-8169-
d1b9434f5ba4');
DELETE FROM CH_OUTPUT;
CALL _SYS_AFL.EML_CLOUDHOOK_GETBLOB_PROC(CH_PARAMS, CH_INPUT, CH_OUTPUT) WITH
OVERVIEW;
As a result, CH_OUTPUT will have the previously written BLOB object (from the CLOUDHOOK_SENDBLOB
example) under the "Tag" "SavedModel".
SAP HANA External Machine Learning Library for SAP HANA Platform
30 PUBLIC CloudHook
6 Important Disclaimer for Features in SAP
HANA
For information about the capabilities available for your license and installation scenario, refer to the Feature
Scope Description for SAP HANA.
SAP HANA External Machine Learning Library for SAP HANA Platform
Important Disclaimer for Features in SAP HANA PUBLIC 31
Important Disclaimers and Legal Information
Hyperlinks
Some links are classified by an icon and/or a mouseover text. These links provide additional information.
About the icons:
● Links with the icon : You are entering a Web site that is not hosted by SAP. By using such links, you agree (unless expressly stated otherwise in your
agreements with SAP) to this:
● The content of the linked-to site is not SAP documentation. You may not infer any product claims against SAP based on this information.
● SAP does not agree or disagree with the content on the linked-to site, nor does SAP warrant the availability and correctness. SAP shall not be liable for any
damages caused by the use of such content unless damages have been caused by SAP's gross negligence or willful misconduct.
● Links with the icon : You are leaving the documentation for that particular SAP product or service and are entering a SAP-hosted Web site. By using such
links, you agree that (unless expressly stated otherwise in your agreements with SAP) you may not infer any product claims against SAP based on this
information.
Example Code
Any software coding and/or code snippets are examples. They are not for productive use. The example code is only intended to better explain and visualize the syntax
and phrasing rules. SAP does not warrant the correctness and completeness of the example code. SAP shall not be liable for errors or damages caused by the use of
example code unless damages have been caused by SAP's gross negligence or willful misconduct.
Bias-Free Language
SAP supports a culture of diversity and inclusion. Whenever possible, we use unbiased language in our documentation to refer to people of all cultures, ethnicities,
genders, and abilities.
SAP HANA External Machine Learning Library for SAP HANA Platform
32 PUBLIC Important Disclaimers and Legal Information
SAP HANA External Machine Learning Library for SAP HANA Platform
Important Disclaimers and Legal Information PUBLIC 33
www.sap.com/contactsap
SAP and other SAP products and services mentioned herein as well as
their respective logos are trademarks or registered trademarks of SAP
SE (or an SAP affiliate company) in Germany and other countries. All
other product and service names mentioned are the trademarks of their
respective companies.