Skip to main content

Introduction

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.

For information, see: PEP 249 – Python Database API Specification v2.0

Getting Started

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

Quick Start

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

  • For HANA system databases in a multitenant system, the port number is 3**NN**13.

  • For HANA single-tenant databases, the port number is 3**NN**15.

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

Execute a single statement that does not return a result set:

cursor.execute("CREATE TABLE T1 (ID INTEGER PRIMARY KEY, C2 VARCHAR(255))")
cursor.close()

Use question mark parameter binding to insert values into the T1 table created above. The parameter values are supplied as a Python sequence and can be literal values or variable names. This example uses literal values:

sql = 'INSERT INTO T1 (ID, C2) VALUES (?, ?)'
cursor = conn.cursor()
cursor.execute(sql, (1, 'hello'))
# returns True
cursor.execute(sql, (2, 'hello again'))
# returns True
cursor.close()

Use named parameter binding to insert values into the T1 table. The values are supplied as a Python dictionary, and this example uses variable names.

sql = 'INSERT INTO T1 (ID, C2) VALUES (:id, :c2)'
cursor = conn.cursor()
id = 3
c2 = "goodbye"
cursor.execute(sql, {"id": id, "c2": c2})
# returns True
cursor.close()

Loop over the rows of the result set.

sql = 'SELECT * FROM T1'
cursor = conn.cursor()
cursor.execute(sql)
for row in cursor:
    print(row)

Help

See the SAP HANA Client Interface Programming Reference for details about developing with the SAP HANA Python Client.

Community

SAP Community provides a forum where you can ask and answer questions, and comment and vote on the questions of others and their answers.

See SAP HANA Community Questions for details.

Limitations of 32-bit Windows driver

The maximum length of a LOB column for the 32-bit Python driver on Windows is 2147483647. The maximum rowcount that can be returned for the 32-bit Python driver on Windows is 2147483647.

License

The HANA Python Client is provided via the SAP Developer License Agreement.

By using this software, you agree that the following text is incorporated into the terms of the Developer Agreement:

If you are an existing SAP customer for On Premise software, your use of this current software is also covered by the terms of your software license agreement with SAP, including the Use Rights, the current version of which can be found at: https://www.sap.com/about/agreements/product-use-and-support-terms.html?tag=agreements:product-use-support-terms/on-premise-software/software-use-rights

Release files for hdbcli 2.18.22

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for hdbcli 2.18.22
File
hdbcli-2.18.22-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details
hdbcli-2.18.22-cp36-abi3-win_amd64.whl CPython 3.6 abi3 Windows x86-64 Details
hdbcli-2.18.22-cp36-abi3-win32.whl CPython 3.6 abi3 Windows x86-32 Details
hdbcli-2.18.22-cp36-abi3-manylinux2014_aarch64.whl CPython 3.6 abi3 Linux glibc 2.17+ ARM64 Details
hdbcli-2.18.22-cp34-abi3-manylinux2014_ppc64le.whl CPython 3.4 abi3 Linux glibc 2.17+ PowerPC 64-le Details
hdbcli-2.18.22-cp34-abi3-manylinux1_x86_64.whl CPython 3.4 abi3 Linux glibc 2.5+ x86-64 Details
hdbcli-2.18.22-cp34-abi3-macosx_10_11_x86_64.whl CPython 3.4 abi3 macOS 10.11+ x86-64 Details
hdbcli-2.18.22-cp27-cp27mu-manylinux2014_ppc64le.whl CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.17+ PowerPC 64-le Details
hdbcli-2.18.22-cp27-cp27mu-manylinux1_x86_64.whl CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-64 Details
hdbcli-2.18.22-cp27-cp27mu-macosx_10_7_x86_64.whl CPython 2.7 CPython 2.7 pymalloc wide-unicode macOS 10.7+ x86-64 Details
hdbcli-2.18.22-cp27-cp27m-win_amd64.whl CPython 2.7 CPython 2.7 pymalloc Windows x86-64 Details
hdbcli-2.18.22-cp27-cp27m-manylinux2014_ppc64le.whl CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.17+ PowerPC 64-le Details
hdbcli-2.18.22-cp27-cp27m-manylinux1_x86_64.whl CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-64 Details
hdbcli-2.18.22-cp27-cp27m-macosx_10_7_x86_64.whl CPython 2.7 CPython 2.7 pymalloc macOS 10.7+ x86-64 Details

Total release size: 107.3 MB

Release files / hdbcli-2.18.22-cp38-abi3-macosx_11_0_arm64.whl

Download URL hdbcli-2.18.22-cp38-abi3-macosx_11_0_arm64.whl
Size 5.2 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
11df352a21ba2bdecc859df821bfcb340cc5f30b02b4d900d0e48f1f44a27b6b
BLAKE2b-256 checksum
How to use checksums
aee4a27f0a7b280e72b4a67d2e4b0a74db0253a2c04bfb3c75a224211bcdc338
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

Release files / hdbcli-2.18.22-cp36-abi3-win_amd64.whl

Download URL hdbcli-2.18.22-cp36-abi3-win_amd64.whl
Size 3.5 MB
Tags CPython 3.6 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
60a07240a7a3e1da2ecd5820b85addc5a42873acf4e1fa78185fd324044f945f
BLAKE2b-256 checksum
How to use checksums
2be4da3f1e17f332552b2f327cc3a189b7faf91d18571393003d0e28b87c1507
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

Release files / hdbcli-2.18.22-cp36-abi3-win32.whl

Download URL hdbcli-2.18.22-cp36-abi3-win32.whl
Size 3.1 MB
Tags CPython 3.6 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
aadc4424861ba81e5dbe4a5ffac0425672766f6029542ca7588e2f154059d912
BLAKE2b-256 checksum
How to use checksums
1423e358a1603add7f19816545f3373e2d596d9978cbfd1e35739862f1dfe8a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

Release files / hdbcli-2.18.22-cp36-abi3-manylinux2014_aarch64.whl

Download URL hdbcli-2.18.22-cp36-abi3-manylinux2014_aarch64.whl
Size 10.7 MB
Tags CPython 3.6 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
fa15311dbfc7ec86b2b033d8b581208b53fdf070b8fe41c7a5c5fe4dea324b8b
BLAKE2b-256 checksum
How to use checksums
4f75ef2c75a23af209d0f19fba707dadb8e7f9b5acbd120cc08e54a8e0615001
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

Release files / hdbcli-2.18.22-cp34-abi3-manylinux2014_ppc64le.whl

Download URL hdbcli-2.18.22-cp34-abi3-manylinux2014_ppc64le.whl
Size 10.8 MB
Tags CPython 3.4 Linux glibc 2.17+ PowerPC 64-le abi3
SHA-256 checksum
How to use checksums
974eb9a4226d6e0f692ae4bd826a2f37b0293a72f8859651af86857103d1b850
BLAKE2b-256 checksum
How to use checksums
26a1aaef11e20688f64d2cbdd435e7dd20a3937f52eea000ff876a7b4c59f2eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

Release files / hdbcli-2.18.22-cp34-abi3-manylinux1_x86_64.whl

Download URL hdbcli-2.18.22-cp34-abi3-manylinux1_x86_64.whl
Size 10.7 MB
Tags CPython 3.4 Linux glibc 2.5+ x86-64 abi3
SHA-256 checksum
How to use checksums
011f8b39b8237290ec28bbd21060e39d208e7392cbba468840664c338dca27db
BLAKE2b-256 checksum
How to use checksums
a82b784524c9ead5c489a409f83b4ae2f305aa3a9b8e47f4a9ea8a3b9a0dcab1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

Release files / hdbcli-2.18.22-cp34-abi3-macosx_10_11_x86_64.whl

Download URL hdbcli-2.18.22-cp34-abi3-macosx_10_11_x86_64.whl
Size 5.6 MB
Tags CPython 3.4 abi3 macOS 10.11+ x86-64
SHA-256 checksum
How to use checksums
0b06622a2db3d25b6d1471b44c602bbe251fdff3ef375c9919b273e6258b08df
BLAKE2b-256 checksum
How to use checksums
d297b4ef105c94813e951ca0c49cff9ad67be09bf322368f7dec4c805e0150a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

Release files / hdbcli-2.18.22-cp27-cp27mu-manylinux2014_ppc64le.whl

Download URL hdbcli-2.18.22-cp27-cp27mu-manylinux2014_ppc64le.whl
Size 10.8 MB
Tags CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.17+ PowerPC 64-le
SHA-256 checksum
How to use checksums
b5e38da5ae618e2cc4bb7abf835a4f75c451fa7392c3d9412f7102e13abc6607
BLAKE2b-256 checksum
How to use checksums
1f4e6367a89617cf4e9a8d2383fb0945824780e3579f64297603752c38afbcdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

Release files / hdbcli-2.18.22-cp27-cp27mu-manylinux1_x86_64.whl

Download URL hdbcli-2.18.22-cp27-cp27mu-manylinux1_x86_64.whl
Size 10.7 MB
Tags CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
05dee290313266aa1e216dc2611a04f8a84bd2171f4d63abf7030dcd03af7a32
BLAKE2b-256 checksum
How to use checksums
f33b04be6c0cc92cc7d4281adc50248683920c3d4414d43a277c0a53ba62857d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

Release files / hdbcli-2.18.22-cp27-cp27mu-macosx_10_7_x86_64.whl

Download URL hdbcli-2.18.22-cp27-cp27mu-macosx_10_7_x86_64.whl
Size 5.6 MB
Tags CPython 2.7 CPython 2.7 pymalloc wide-unicode macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
3e034f82574d204c8a58c2524fc3c962df9090f2ecdd931ebde88ebdb00fde49
BLAKE2b-256 checksum
How to use checksums
f6642dceaef36dd5991440f06deb5162f58c0fb4c93417e749fbbf9666bd2621
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

Release files / hdbcli-2.18.22-cp27-cp27m-win_amd64.whl

Download URL hdbcli-2.18.22-cp27-cp27m-win_amd64.whl
Size 3.5 MB
Tags CPython 2.7 CPython 2.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
8bf810f629fe0d9f1fbc70c2c1fc5061ebe3e419f3889cd31ccbf1d1dd08f3b1
BLAKE2b-256 checksum
How to use checksums
588299b0ec994c94f0dc4ee9e29ea039bc182c36cdd2eb7834b0d2371605b56f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

Release files / hdbcli-2.18.22-cp27-cp27m-manylinux2014_ppc64le.whl

Download URL hdbcli-2.18.22-cp27-cp27m-manylinux2014_ppc64le.whl
Size 10.8 MB
Tags CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.17+ PowerPC 64-le
SHA-256 checksum
How to use checksums
1f3781f17196ed461fe5f59092854fe22f0e9c683d8e26dee92042c01dfcd34a
BLAKE2b-256 checksum
How to use checksums
1294b5581941f180f1f4b3b2557d8634fec6ba8f2e48ea652b2bdae6e2026ec4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

Release files / hdbcli-2.18.22-cp27-cp27m-manylinux1_x86_64.whl

Download URL hdbcli-2.18.22-cp27-cp27m-manylinux1_x86_64.whl
Size 10.7 MB
Tags CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
5dbc5d6f3573827fcb9a5e8f18185c2e8e813e7fd64efcf7a511fa9a20a1a9cb
BLAKE2b-256 checksum
How to use checksums
d82b5bc175ddb068c8a518f64d62b57b3e1d6ea717e7e9d66b8ca5b53da96dc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

Release files / hdbcli-2.18.22-cp27-cp27m-macosx_10_7_x86_64.whl

Download URL hdbcli-2.18.22-cp27-cp27m-macosx_10_7_x86_64.whl
Size 5.6 MB
Tags CPython 2.7 CPython 2.7 pymalloc macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
7670de42c4afc76cb3c9a3e91f5712a08848ffd6b37d3ae447061acceeb24439
BLAKE2b-256 checksum
How to use checksums
c4867fae8b821c9432ca4f9f2ba4cd210b9724839705b3099a02efdcd1e7d03a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

Release history Release notifications | RSS feed

This release

2.18.22 This release

14 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page