SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
โคข Open full site

Connect SAP HANA Database in SAP HANA Cloud to Python

Learn to set up a connection between SAP HANA database in SAP HANA Cloud and Jupyter Notebook.

Overview

🎓 advanced 15 min. SAP HANA CloudAdvancedSAP HANA CloudSAP HANA DatabaseSAP HANA Multi Model ProcessingSAP HANA GraphSAP HANA Spatial

You will learn

  • โœ”What the hana-ml library is
  • โœ”What an SAP HANA data-frame is
  • โœ”How to set up your Jupyter Notebook connection for an SAP HANA database in SAP HANA Cloud
  • โœ”What a connection context is
Christoph Morgen C Christoph Morgen February 6, 2025
Created by July 16, 2021
Contributors

Prerequisites

Prerequisites

Steps

Intro

This tutorial is part of a tutorial group, in which you will learn how to use the new enhanced features of hana-ml library that support the multi-model capabilities of SAP HANA Cloud, SAP HANA database. This tutorial group will focus on creation, visualization, and analysis of a Graph Workspace in the database using sample data based on Wellington’s storm water network.

The goal is to introduce you to various algorithms in the hana-ml library that can help to visualize and analyze the data in the form of graphs.

In this tutorial, you will create a connection between your database instance and your Python environment based on the data from Wellington Water Open Data Portal.

The following terms are used in specific contexts:

data-frame : when referring to the logical concept of a data frame

dataframe : when referring to a Python Object


Step 1 Introduction to hana-ml library
โ€”

The hana-ml package allows you to create an SAP HANA data-frame, as well as create a connection to your database instance. The SAP HANA data-frame represents a database query as a data-frame. This package enables Python users to access the data-frame, build various machine learning models and run graph algorithms using the data directly from the database.

The Python machine learning client (hana-ml) for SAP HANA Cloud consists of four main parts:

  • SAP HANA data-frame, which provides a set of methods for accessing and querying data in SAP HANA without bringing the data to the client.

  • A set of machine learning APIs for developing machine learning models.

  • A selection of data science tools for deployment, operation, and visualization.

  • Integration of multi-model capabilities for geo-spatial and graph analysis

This tutorial will focus on exploring the integration of multi-modal capabilities for geo-spatial and graph analysis.

This hana-ml library uses SAP HANA Python driver (hdbcli) to connect to and access SAP HANA Cloud.

A figure of this architecture is shown below:

hana-ml-architecture
hana-ml-architecture

Step 2 What is an SAP HANA data-frame?
+
Step 3 Set up your Python environment
+
Step 4 Create login data of database instance in Jupyter Notebook
+
Step 5 Establish connection to the database
+
Step 6 Test yourself
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 6
1. Introduction to hana-ml library 2. What is an SAP HANA data-frame? 3. Set up your Python environment 4. Create login data of database instance in Jupyter Notebook 5. Establish connection to the database 6. Test yourself

Learn more →