Skip to Content

You might have already seen my earlier blog introducing SAP HANA External Machine Learning library which discusses how you can access TensorFlow models from HANA?

Well in the rush to produce hands-on video tutorials in time for RTC (release to customer) perhaps the content wasn’t as elegant as it could be.

The scenario involved tweaking of the standard TensorFlow MNIST model to change the default signature and a HANA table with 784 columns – Ouch!

Partly this was due to me using an internal pre-release – some things changed between that and RTC – but also very much due to my lack of knowledge. Interesting your feedback also made it clear that not everyone has a TensorFlow Serving environment up and running – so perhaps we could provide some pointers in that area too?

A lot of water has passed under the bridge since then and having had time for additional research we’ve been able to significantly revise the content. Yesterday we published 6 all-new video tutorials that show how to get going with the EML and TensorFlow and all in the context of SAP HANA, express edition.

The scenario now uses the standard MNIST model without modification, has a single BLOB column in HANA to store the image of a handwritten digit, and uses Database Explorer (via Web IDE for SAP HANA) rather than Eclipse as the development environment (though you could still use Eclipse if you prefer).

There’s a video showing how to install and configure TensorFlow with Tensorflow Serving from scratch in Google Cloud Platform – and given that SAP HANA, Express Edition is also available there you can take full advantage of the free trial!

Very much inspired by Frank Gottfried‘s excellent blog here. there’s also a video showing how to get started with the now fully supported Python driver delivered with SAP HANA Client Tools in SPS 02. This enables you to load test data directly into HANA using a Python script. You don’t need to do this to follow along with the tutorials however as a few rows of MNIST test data have also been published to our GitHub repository which can easily be imported via Database Explorer.

It’s the same playlist as before: SAP HANA Academy – EML Playlist

There are now 7 main videos covering the following topics:

UPDATE: 11Oct17 – HANA 2.0 SPS02 revision 21 introduces significant changes to the way output tensors are handled. If you’re using revision 21 please refer to the following tutorial for updates to the real-time scoring example with MNIST:

The previous videos are still there at the foot of the playlist – just in case you’re addicted to Eclipse:

You’ll also find above tutorials posted to the What’s New for Predictive HANA 2.0 SPS 02 playlist where you can also get the low down on enhancements to the Predictive Analysis Library (PAL) featuring the all-new web-based Application Function Modeler, as well improvements to R Integration.

If you’re interested to learn about what’s new with HANA 2.0 SPS 02 in general check out the following blog.

Should you be attending SAP TechEd please drop by our SAP HANA Academy event on the Monday. A full day of lecture/demo and hands-on sessions where we’ll be covering the EML / TensorFlow as well as other hot HANA topics – and unlike YouTube you can interrupt us to ask questions! Attendance is free and we’ll help you get started with SAP HANA, express edition on the Google Cloud Platform using the free trial – so you can keep your work afterwards.

May your tensors flow with HANA!

The SAP HANA Academy provides free online video tutorials for the developers, consultants, partners and customers of SAP HANA.

Topics range from practical how-to instructions on administration, data loading and modeling, and integration with other SAP solutions, to more conceptual projects to help build out new solutions using mobile applications or predictive analysis.

For the full library, see SAP HANA Academy Library – by the SAP HANA Academy

For the full list of blogs, see Blog Posts – by the SAP HANA Academy

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Johnny Chan

    Hi! Please do you know if Is it possible to deploy the entire SAP HANA EML + TensorFlow Serving all within the SAP Cloud (without touching other clouds like Google, AWS, Azure, etc).?

    e.g SAP Cloud containing a HANA DB + a VM instance with Tensorflow running on it. All within the SAP Cloud. (Neo environment)

    1. Philip MUGGLESTONE Post author

      Hi Johnny,

      Not that I’m aware of however you can use the SAP Leonardo Machine Learning Foundation which is built on SAP Cloud Platform:



  2. Nemanja Radojkovic

    Hello, Philip,


    we are building a tailored text classifier on the SAP platform, but would like to avoid using Tensorflow, at least for the moment.

    So, could a custom ML model also be served in the same way as TF models are?

    If I understand correctly, the model is served via some kind of an HTTP REST API, where certain “alignments” need to made for it to work seamlessly, which to me doesn’t sounds quite generic and customizeable.


    Thanks in advance!







    1. Philip MUGGLESTONE Post author

      H Nemanja,

      SAP HANA provides a number of ways you have make use of ML/predictive, integration with TF is just one of them.

      Just to avoid any confusion, TensorFlow Serving “serves” TF models that have already been trained and is specific technology to TensorFlow. HANA acts as a “client” by the “remote” TF server to perform inference/scoring.

      For custom ML beyond TensorFlow, maybe consider using the R integration for SAP HANA (link to playlist) where you can basically do anything you want on the R side by embedding R script into a HANA stored procedure. Again HANA acts as the “client” and connects to the “remote” Rserve which actually does the processing.

      Hope that helps?


      1. Nemanja Radojkovic

        Hi, Philip,

        first of all — thanks for the lightning-fast reply. 🙂

        Yes, I am aware of R integration (which is a bit more “embedded”, as I can see), but we are looking to reuse our existing Python (scikit-learn) code or maybe export the model to PMML and then use “openscoring” to serve the model via a REST API.

        Since TF is also running on a VM within SAP Cloud, and “serves” it’s predictions via an HTTP API, to me it seems like HANA+EML is not actually “married” to Tensorflow and “doesn’t care” what’s on the other side of the line — as long as it responds to its requests and delivers the response in a specific format that HANA requires.

        Did I understand things correctly?

        Many thanks in advance!



        1. Burkhard Neidecker-Lutz

          Hello Nemanja,


          the current EML implementation does *not* use a generic REST API, but rather the somewhat higher performing gRPC mechanism and the TensorFlow Serving protocol layered on top of that. Thus the current version is indeed married to TensorFlow.

          If you were absolutely bent on integrating your current code that way, you could write your own python-based TensorFlow Serving server and point the EML at that. A “conforming” server would only need to implement the GetModelMetaData and Predict calls of the full TensorFlow Serving protocol and can actually be implemented in a moderate amount of python. even if it is no match for the full blown C++ based server.


  3. Naveen Kumar

    Hello Philip,

    Sorry was on different assignment so did not get time earlier to look into it. I am able to follow you all the way as shown in the video. However I get stuck while running the python script:


    Traceback (most recent call last):
    File “”, line 28, in <module>
    from tensorflow.examples.tutorials.mnist import input_data
    ImportError: No module named tensorflow.examples.tutorials.mnist


    I tried to check but not sure if the module is available or not. Can you please suggest something on this.

    Best Regards,


    1. Philip MUGGLESTONE Post author

      Hi Naveen,

      The script is from the standard TF tutorial:

      I wonder if you’re tensorflow machine is behind a firewall and that is why the script is unable to download the MNIST demo data?

      I suggest you follow the tutorial ( by pasting the code step by step rather than running the entire script in one go – this may help you debug what’s going wrong.




    1. Philip MUGGLESTONE Post author

      Hi Sumit,

      Yes of course – using the HXE download manager.

      The download process is shown in the video starting at 2 minutes and the install process at 5 minutes.

      To download and install the HXE download manager itself register here:



      1. Sumit Kumar Kundu

        Hi Philip,

        I did not install HXE locally, Google Cloud launcher service installed it for me as VM on GCP compute engine. The link you provided will also work in my case, I thought this is the whole package of HXE.




Leave a Reply