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 to Data Lake Relational Engine Using Python Drivers

Create and debug a Python application that connects to a data lake Relational Engine using the sqlanydb python driver or the pyodbc bridge.

Overview

🎓 beginner 15 min. SAP HANA Cloud Data LakeBeginnerSAP HANA CloudPython

You will learn

  • βœ”How to install Python, the sqlanydb, and pyodbc Python drivers
  • βœ”How to create, run, and debug a Python application that connects to and queries a data lake Relational Engine database

Prerequisites

Prerequisites

  • You have completed the first 2 tutorials in this group

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 data lake Relational Engine.

Step 1 Install Python
β€”

The first step is to check if Python and pip are installed.

  1. Enter the commands below.

    Shell
    python --version
    python3 --version

    If Python is installed, the command will return a value such as Python 3.13.0

    In some Linux distributions, ‘python’ refers to Python 2, while ‘python3’ refers to Python 3. However, as Python 2 is now obsolete, ‘python’ may refer to Python 3 instead. It may also be referred to by its specific version such as python3.13.

    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. The Microsoft Windows command prompt or shell will need to be reopened after Python is installed to pick up the path to python.

    python-install
    python-install

    On OpenSUSE Tumbleweed, yast can be used to install python313. Once it has been installed its version can be seen with the below command.

    Shell
    python3.13 --version
  2. Enter the commands below.

    Shell
    pip --version
    pip3 --version
    pip install --upgrade pip

    If you encounter issues with user permissions, run command prompt as an administrator and try again.

    The standard package installer for Python is pip. The following commands will check the version of pip and attempt to upgrade it to the latest available version.

    On Linux, if you encounter permission issues, one way to solve the issue is to use sudo before the command.


    On Linux, if Python is installed but pip is not, it can be installed on openSUSE using Zypper as shown below.

    Shell

    zypper install python3-pip

    Code
Step 2 Install the sqlanydb Python driver
+
Step 3 Create a Python application that uses sqlanydb to query the data lake Relational Engine
+
Step 4 Install the Python ODBC bridge using pip and PyPI
+
Step 5 Create a Python application that uses pyodbc to query the data lake Relational Engine
+
Step 6 Debug the application
+
Step 7 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 7
1. Install Python 2. Install the sqlanydb Python driver 3. Create a Python application that uses sqlanydb to query the data lake Relational Engine 4. Install the Python ODBC bridge using pip and PyPI 5. Create a Python application that uses pyodbc to query the data lake Relational Engine 6. Debug the application 7. Knowledge check

Learn more →