Skip to content

yasinnaal/hdbcli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 

Repository files navigation

Introducing hdbcli SAP HANA Python Client

Connect to SAP HANA databases using Python

The Python Database API Specification v2.0 (PEP 249) defines a set of methods that provides a consistent database interface independent of the actual database being used. The Python extension module for SAP HANA implements PEP 249.

Once you install the module, you can access and change the information in SAP HANA databases from Python. In PEP 249, autocommit is turned off by default. In the SAP HANA Python driver, autocommit is turned on by default.

The SAP HANA client supports Python 3.4 and later and Python 2.7.

Install the Python Driver

use the Python driver to connect to an SAP HANA database.

Install the Python driver into your local Python environment by using the pip installer so that you can use the Python driver to connect to an SAP HANA database.

Download files

Getting Started

Install via pip install hdbcli or install manually via the HANA Client Install

Prerequisites

You have run the SAP HANA client install.

Procedure

  1. If you have multiple Python environments, then activate the Python environment where you want to install the Python driver. If you don’t have multiple Python environments, then ignore this step.
  2. Run the install:

Microsoft Windows

pip install

pip install "C:\Program Files\SAP\hdbclient\hdbcli-N.N.N.zip"

easy_install

easy_install "C:\Program Files\SAP\hdbclient\hdbcli-N.N.N.zip"

disutils installer

Unzip hdbcli-N.N.N.zip into a directory, then run:

cd hdbcli-N.N.N

Lastly, run:

setup.py install

UNIX, Linux, and macOS

Use one of the following install methods:

pip install

pip install /usr/sap/hdbclient/hdbcli-N.N.N.tar.gz

easy_install

pip install /usr/sap/hdbclient/hdbcli-N.N.N.tar.gz

disutils installer

tar -xf hdbcli-N.N.N.tar.gz

Then run:

cd hdbcli-N.N.N

Lastly, run:

setup.py install

For HANA tenant databases, use the port number 3NN13 (where NN is the SAP instance number - e.g. 30013).

For HANA system databases in a multitenant system, the port number is 3NN13.

For HANA single-tenant databases, the port number is 3NN15.

from hdbcli import dbapi
conn = dbapi.connect(
    address="<hostname>",
    port=3<NN>MM,
    user="<username>",
    password="<password>"
)
cursor = conn.cursor()

References

Python hdbcli

SAP Note 3136015

License

Other/Proprietary License (SAP DEVELOPER LICENSE AGREEMENT)

About

hdbcli SAP HANA Python Client

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published