SAP

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

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 August 21, 2026
Created on August 3, 2021
Contributors

More from Christoph Morgen

See all 3 tutorials by Christoph Morgen →

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 6 Establish connection to the database
+
Step 7 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 7
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. Import libraries for connecting to database 6. Establish connection to the database 7. Test yourself
Next