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 Cloud databases, the port number is 443 and encryption is always enabled by default

  • 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

Metadata

Release files for hdbcli 2.22.27

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.22.27
File
hdbcli-2.22.27-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details
hdbcli-2.22.27-cp36-abi3-win_amd64.whl CPython 3.6 abi3 Windows x86-64 Details
hdbcli-2.22.27-cp36-abi3-win32.whl CPython 3.6 abi3 Windows x86-32 Details
hdbcli-2.22.27-cp36-abi3-manylinux2014_aarch64.whl CPython 3.6 abi3 Linux glibc 2.17+ ARM64 Details
hdbcli-2.22.27-cp34-abi3-manylinux2014_ppc64le.whl CPython 3.4 abi3 Linux glibc 2.17+ PowerPC 64-le Details
hdbcli-2.22.27-cp34-abi3-manylinux1_x86_64.whl CPython 3.4 abi3 Linux glibc 2.5+ x86-64 Details
hdbcli-2.22.27-cp34-abi3-macosx_10_11_x86_64.whl CPython 3.4 abi3 macOS 10.11+ x86-64 Details
hdbcli-2.22.27-cp27-cp27mu-manylinux2014_ppc64le.whl CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.17+ PowerPC 64-le Details
hdbcli-2.22.27-cp27-cp27mu-manylinux1_x86_64.whl CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-64 Details
hdbcli-2.22.27-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.22.27-cp27-cp27m-win_amd64.whl CPython 2.7 CPython 2.7 pymalloc Windows x86-64 Details
hdbcli-2.22.27-cp27-cp27m-manylinux2014_ppc64le.whl CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.17+ PowerPC 64-le Details
hdbcli-2.22.27-cp27-cp27m-manylinux1_x86_64.whl CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-64 Details
hdbcli-2.22.27-cp27-cp27m-macosx_10_7_x86_64.whl CPython 2.7 CPython 2.7 pymalloc macOS 10.7+ x86-64 Details

Total release size: 110.4 MB

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

Download URL hdbcli-2.22.27-cp38-abi3-macosx_11_0_arm64.whl
Size 5.0 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1721854cecc4efb51eff7b2271e34eddd7e41175263124a03ab460373e126507
BLAKE2b-256 checksum
How to use checksums
57f7e8be22121c8c5fca189491ab0b0701907385cc34355a1ea8847f056292f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

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

Download URL hdbcli-2.22.27-cp36-abi3-win_amd64.whl
Size 3.6 MB
Tags CPython 3.6 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
aa2e889928ad8382857605c1a29ea269073817271f31450bab5b9956d719fbb2
BLAKE2b-256 checksum
How to use checksums
55d8505c121c1e88ce44a2dedcdf21cb8e65ac11e6fc59e5d0703b9de5781b4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

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

Download URL hdbcli-2.22.27-cp36-abi3-win32.whl
Size 3.6 MB
Tags CPython 3.6 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
77b2a5eb121bfae1223a1c9c3ad6f2deb657388508e448c543ab73e239354787
BLAKE2b-256 checksum
How to use checksums
abadde2677b5459e196cc2b9b261ded67e887784334f08fef7717a7d2709b595
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

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

Download URL hdbcli-2.22.27-cp36-abi3-manylinux2014_aarch64.whl
Size 11.1 MB
Tags CPython 3.6 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
9ac9b6c940658466c2644a5e86ba50925d2c9f4e7a6ccd63da91829c8c0fb5a3
BLAKE2b-256 checksum
How to use checksums
fb354b8d6f901439621316e1148d4769289122627d1c313904a509bb145bf694
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

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

Download URL hdbcli-2.22.27-cp34-abi3-manylinux2014_ppc64le.whl
Size 11.2 MB
Tags CPython 3.4 Linux glibc 2.17+ PowerPC 64-le abi3
SHA-256 checksum
How to use checksums
e0fa0b2a56df120654d446049142417909c3dfaf3c2181de099473e0b9087875
BLAKE2b-256 checksum
How to use checksums
70d11ab47b9738a3c6315b42c35cb0ba796c2f605043e3da38eff6eb3995338e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

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

Download URL hdbcli-2.22.27-cp34-abi3-manylinux1_x86_64.whl
Size 11.1 MB
Tags CPython 3.4 Linux glibc 2.5+ x86-64 abi3
SHA-256 checksum
How to use checksums
cbc75e89e639b5edbc07ad75d7fc0bdf41a055b006646c61cd2ede2c5ba2a128
BLAKE2b-256 checksum
How to use checksums
850a428d5e3ee1d9c693da2c34f64895859191535548f60dd5774e52c177e3b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

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

Download URL hdbcli-2.22.27-cp34-abi3-macosx_10_11_x86_64.whl
Size 5.5 MB
Tags CPython 3.4 abi3 macOS 10.11+ x86-64
SHA-256 checksum
How to use checksums
f34999aec6b4c624604f85365a77249ca868c48cc0ddb60ba3a5e0481592fe7d
BLAKE2b-256 checksum
How to use checksums
edf156d4a812938821c65a0b8fa3a52e993b0d98cec21cff2f7e5d003036490f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

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

Download URL hdbcli-2.22.27-cp27-cp27mu-manylinux2014_ppc64le.whl
Size 11.2 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
68b8cd7070403609f69ab062c14ca0424fab4f28bfcbdccd51842f2fb596d3e2
BLAKE2b-256 checksum
How to use checksums
26d2c4ba03a0a545626422479618be5a21c034664333c80ff1fccf832e02acab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

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

Download URL hdbcli-2.22.27-cp27-cp27mu-manylinux1_x86_64.whl
Size 11.1 MB
Tags CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
e479b92826b70f7a63e9d8d24ad677fb04ee6dec0dfe9bb093fcb94d8b40a7e2
BLAKE2b-256 checksum
How to use checksums
6a64b6fc0d8a87eab2f46dc2c22c3abe982da1582bc5eda005af39c45e30cf5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

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

Download URL hdbcli-2.22.27-cp27-cp27mu-macosx_10_7_x86_64.whl
Size 5.5 MB
Tags CPython 2.7 CPython 2.7 pymalloc wide-unicode macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
e7cd64ada8c3a70982e212184a559755ae69cba79936af0e126d65927c8baccd
BLAKE2b-256 checksum
How to use checksums
3cc4db0f52d2e315254d464d9e9bb9537451bf43ca60d073b2761c572430fd22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

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

Download URL hdbcli-2.22.27-cp27-cp27m-win_amd64.whl
Size 3.6 MB
Tags CPython 2.7 CPython 2.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
04d72369c6e1d8d6f39c996597fe353cbc4646df2e96ea0f535f82c2d0e22499
BLAKE2b-256 checksum
How to use checksums
999d021ef1cbcff670a1de86cf6715c92f149d9f93a0594953c63b3ef1556c4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

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

Download URL hdbcli-2.22.27-cp27-cp27m-manylinux2014_ppc64le.whl
Size 11.2 MB
Tags CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.17+ PowerPC 64-le
SHA-256 checksum
How to use checksums
37c818fb82e821e4da72601dc489e76da0741de8cb355120d9775664cc2be1a9
BLAKE2b-256 checksum
How to use checksums
0db1e4d59d974cc7d745c11adc0164c80a30822ee17ce0a02a934dacd342b6ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

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

Download URL hdbcli-2.22.27-cp27-cp27m-manylinux1_x86_64.whl
Size 11.1 MB
Tags CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
9b6660ae9daaa39e866fc753a9b76e1280c1ce3f14f9c581951f14e9a61b19cb
BLAKE2b-256 checksum
How to use checksums
98932a9763bf7650426ccf220fb2456ddeb2adbe7b841da22952e3006fc8b294
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

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

Download URL hdbcli-2.22.27-cp27-cp27m-macosx_10_7_x86_64.whl
Size 5.5 MB
Tags CPython 2.7 CPython 2.7 pymalloc macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
5f98b22fd200bc91697dabe51ffbd58d695a590fa8a7527a3d036e91b6256d40
BLAKE2b-256 checksum
How to use checksums
737da543607f3114c10b480d4236d318d863b20ccb27620946f14c043c9a5b42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

Release history Release notifications | RSS feed

This release

2.22.27 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