Skip to main content

SAP HANA Python Client

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.30.32

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.30.32
File Actions
hdbcli-2.30.32-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for hdbcli-2.30.32-cp310-abi3-win_amd64.whl
hdbcli-2.30.32-cp310-abi3-win32.whl CPython 3.10 abi3 Windows x86-32 Details for hdbcli-2.30.32-cp310-abi3-win32.whl
hdbcli-2.30.32-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details for hdbcli-2.30.32-cp310-abi3-musllinux_1_2_x86_64.whl
hdbcli-2.30.32-cp310-abi3-manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for hdbcli-2.30.32-cp310-abi3-manylinux2014_x86_64.whl
hdbcli-2.30.32-cp310-abi3-manylinux2014_ppc64le.whl CPython 3.10 abi3 Linux glibc 2.17+ PowerPC 64-le Details for hdbcli-2.30.32-cp310-abi3-manylinux2014_ppc64le.whl
hdbcli-2.30.32-cp310-abi3-manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for hdbcli-2.30.32-cp310-abi3-manylinux2014_aarch64.whl
hdbcli-2.30.32-cp310-abi3-macosx_13_0_x86_64.whl CPython 3.10 abi3 macOS 13.0+ x86-64 Details for hdbcli-2.30.32-cp310-abi3-macosx_13_0_x86_64.whl
hdbcli-2.30.32-cp310-abi3-macosx_13_0_arm64.whl CPython 3.10 abi3 macOS 13.0+ ARM64 Details for hdbcli-2.30.32-cp310-abi3-macosx_13_0_arm64.whl

Total release size: 42.0 MB

Release files / hdbcli-2.30.32-cp310-abi3-win_amd64.whl

Download URL hdbcli-2.30.32-cp310-abi3-win_amd64.whl
Size 3.8 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
f21432266cc0de749e80394211c23bd8114c139911a256a1d1a12382b05aa2f9
BLAKE2b-256 checksum
How to use checksums
3888603b196a8dd15e189930624d33708be3b6a8a93adbeed951527cf0209654
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.1

Release files / hdbcli-2.30.32-cp310-abi3-win32.whl

Download URL hdbcli-2.30.32-cp310-abi3-win32.whl
Size 3.5 MB
Tags CPython 3.10 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
a2e33fa94fe7b71b4655918fcecab6d0a1c1456a00c014d518675e3c93d04c1e
BLAKE2b-256 checksum
How to use checksums
59ba81b5771c9b8575a0e8c54041076439b4873656e9ce6e33a5768f35901280
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.1

Release files / hdbcli-2.30.32-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL hdbcli-2.30.32-cp310-abi3-musllinux_1_2_x86_64.whl
Size 6.0 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
3c85eb9999f9f1a280fa7f93be5bb3c224557e00d27645036ed08cf922a0d144
BLAKE2b-256 checksum
How to use checksums
06f6875b6580586c0bf0bef3ccd312f190a57a849000f4c20f7a62d561a18791
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.1

Release files / hdbcli-2.30.32-cp310-abi3-manylinux2014_x86_64.whl

Download URL hdbcli-2.30.32-cp310-abi3-manylinux2014_x86_64.whl
Size 5.9 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
5795c0822b561ac8c64fc2debc59e4520ad0ff3e21d216fde4ea0f41392535cb
BLAKE2b-256 checksum
How to use checksums
3529587a06cdbad9fd3cc4eacc02387052796d389e5a83563604ebc5237a47e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.1

Release files / hdbcli-2.30.32-cp310-abi3-manylinux2014_ppc64le.whl

Download URL hdbcli-2.30.32-cp310-abi3-manylinux2014_ppc64le.whl
Size 6.2 MB
Tags CPython 3.10 Linux glibc 2.17+ PowerPC 64-le abi3
SHA-256 checksum
How to use checksums
2719e82118c53fa0034619eb64f085c9896ae2e17c0cf3dab82f203ba17df4a9
BLAKE2b-256 checksum
How to use checksums
e456df26a11e080c62ac578db82a6443a0c4ae26b732ebc6ecc2343ebc039018
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.1

Release files / hdbcli-2.30.32-cp310-abi3-manylinux2014_aarch64.whl

Download URL hdbcli-2.30.32-cp310-abi3-manylinux2014_aarch64.whl
Size 5.6 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
3868fed13a690d666fc2cf17f66cfd891cfce1b3f1dc967667eae02a94ef08d3
BLAKE2b-256 checksum
How to use checksums
20307fde8fba10e06a0520bd4f6ccdbe57602840282a02d12b7c6fd241863912
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.1

Release files / hdbcli-2.30.32-cp310-abi3-macosx_13_0_x86_64.whl

Download URL hdbcli-2.30.32-cp310-abi3-macosx_13_0_x86_64.whl
Size 5.8 MB
Tags CPython 3.10 abi3 macOS 13.0+ x86-64
SHA-256 checksum
How to use checksums
553d62eeeea59f1800637feffc99470b38f4869bccc3bbd029c49f56765f7684
BLAKE2b-256 checksum
How to use checksums
a1383a5ac3e23dcdf8d2d30bc76ea89aa9a03229e308eccdd179f0d669a7ac9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.1

Release files / hdbcli-2.30.32-cp310-abi3-macosx_13_0_arm64.whl

Download URL hdbcli-2.30.32-cp310-abi3-macosx_13_0_arm64.whl
Size 5.3 MB
Tags CPython 3.10 abi3 macOS 13.0+ ARM64
SHA-256 checksum
How to use checksums
36bf0e3edefb063017dc587107d876264cd12ef6121f8610eb616ab9dc3a5bd9
BLAKE2b-256 checksum
How to use checksums
25b599ce9f0aa0ed29c9e8360a9ea674650935f025c5b1621b5a68b3213651c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.1

Security for hdbcli 2.30.32

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.30.32 This release

8 release files No provenance

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