SAP

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
⤢ Open full site

Connect Using the SAP HANA Python Interface

Create and debug a Python application that connects to SAP HANA using the SAP HANA client.

Overview

You will learn

  • How to install Python and the SAP HANA client Python driver
  • How to create and debug a Python application that queries a SAP HANA database

More from Dan van Leeuwen

See all 59 tutorials by Dan van Leeuwen →

Prerequisites

Prerequisites

  • You have completed the first 3 tutorials in this mission.

Steps

Intro

In the 2023 Stack Overflow’s annual developer survey, Python ranked 3rd in the Most popular technologies section. For further information on Python, see Introduction to Python 3 or The Python Tutorial.

The following steps create a simple Python app that can connect to and query an SAP HANA database.


Step 1 Install Python

The first step is to check if Python is installed.

Enter the commands below.

Shell
python --version
python3 --version

If Python is installed, the command will return a value such as Python 3.13.3. If you are using Python 3, replace pip with pip3 in all commands throughout this tutorial to ensure packages are installed for the correct Python version.

Details on supported versions of Python for the SAP HANA client for Python can be found at SAP Note 3165810 - SAP HANA Client Supported Platforms.

If Python is not installed, it can be downloaded from Python downloads.

On Microsoft Windows, check the box that says Add Python 3.x to PATH as shown below to ensure that the interpreter will be placed in your path.

python-install
python-install

You should now be able to open a new shell and verify that Python is installed.

Step 2 Install SAP HANA client for Python using pip and PyPI
+
Step 3 Create Python application that queries SAP HANA
+
Step 4 Debug the application
+
Step 5 Knowledge check
+

Resources

Discussion

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

Submit detailed feedback Discuss in Community
Steps
Step 1 of 5
1. Install Python 2. Install SAP HANA client for Python using pip and PyPI 3. Create Python application that queries SAP HANA 4. Debug the application 5. Knowledge check
Next