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.20.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.20.22
File
hdbcli-2.20.22-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details
hdbcli-2.20.22-cp36-abi3-win_amd64.whl CPython 3.6 abi3 Windows x86-64 Details
hdbcli-2.20.22-cp36-abi3-win32.whl CPython 3.6 abi3 Windows x86-32 Details
hdbcli-2.20.22-cp36-abi3-manylinux2014_aarch64.whl CPython 3.6 abi3 Linux glibc 2.17+ ARM64 Details
hdbcli-2.20.22-cp34-abi3-manylinux2014_ppc64le.whl CPython 3.4 abi3 Linux glibc 2.17+ PowerPC 64-le Details
hdbcli-2.20.22-cp34-abi3-manylinux1_x86_64.whl CPython 3.4 abi3 Linux glibc 2.5+ x86-64 Details
hdbcli-2.20.22-cp34-abi3-macosx_10_11_x86_64.whl CPython 3.4 abi3 macOS 10.11+ x86-64 Details
hdbcli-2.20.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.20.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.20.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.20.22-cp27-cp27m-win_amd64.whl CPython 2.7 CPython 2.7 pymalloc Windows x86-64 Details
hdbcli-2.20.22-cp27-cp27m-manylinux2014_ppc64le.whl CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.17+ PowerPC 64-le Details
hdbcli-2.20.22-cp27-cp27m-manylinux1_x86_64.whl CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-64 Details
hdbcli-2.20.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: 108.0 MB

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

Download URL hdbcli-2.20.22-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
eff39768fcaa34af1a84f4ef02082aa74bcffc06367da239967244b900e2eaf6
BLAKE2b-256 checksum
How to use checksums
2ac7891c3be151a609f1c51362d4ea634b9130b77511c093a6bc2b10aa20595c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.1

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

Download URL hdbcli-2.20.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
8b7e25ab0fc41fbd18ec6255f6c8a28b350dde869c4e09b42c5e04e344cdb258
BLAKE2b-256 checksum
How to use checksums
369c72611e8a9bfc4f24a088cde84cd73312e8dd10a6c901c4e9df243fa69af5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.1

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

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

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

Download URL hdbcli-2.20.22-cp36-abi3-manylinux2014_aarch64.whl
Size 10.8 MB
Tags CPython 3.6 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
17827a09155f3f7f4603421e8839060b063591e5ba94cdb7668340050337e4b1
BLAKE2b-256 checksum
How to use checksums
bb1926ae1386c4a91c8392596537df7970719ee8664f84dddb3241f6d9c2691a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.1

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

Download URL hdbcli-2.20.22-cp34-abi3-manylinux2014_ppc64le.whl
Size 10.9 MB
Tags CPython 3.4 Linux glibc 2.17+ PowerPC 64-le abi3
SHA-256 checksum
How to use checksums
39e85c52c26636c4ddc7e6d1e784a4723cd62b76962a0e58ab6f94d0bce65dff
BLAKE2b-256 checksum
How to use checksums
ca46325e2fea419df5eeff57ca772976a5a1932817d72cd67683176350675b35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.1

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

Download URL hdbcli-2.20.22-cp34-abi3-manylinux1_x86_64.whl
Size 10.8 MB
Tags CPython 3.4 Linux glibc 2.5+ x86-64 abi3
SHA-256 checksum
How to use checksums
4b53ea5d75a951d408910db9a0b39c02c10f4da4d7f7f92c327ce3a9e17d3a2a
BLAKE2b-256 checksum
How to use checksums
e03ad83765c8461e99c05f1e83ca51b44ef1d4dacd3c960a8ff4d7555c45fcd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.1

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

Download URL hdbcli-2.20.22-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
2a7f673e9ed65fd201765cbc4aecfd2481a3a963e89c17facd098909e3205516
BLAKE2b-256 checksum
How to use checksums
acc2bc87942980a2317f722d674bcdcc06c305a6228706e8ae47dbadb0c8a2e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.1

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

Download URL hdbcli-2.20.22-cp27-cp27mu-manylinux2014_ppc64le.whl
Size 10.9 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
63d125951bdd679dfe1d040a398e14dfe655e4223a3aacb7b876fb67a57c3743
BLAKE2b-256 checksum
How to use checksums
8591582f5e68504381b35385e777e7459a61cd82dcc3caf485fdcc6ad3a50907
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.1

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

Download URL hdbcli-2.20.22-cp27-cp27mu-manylinux1_x86_64.whl
Size 10.8 MB
Tags CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
b9abf269825ff4a2369d871dabf7e70af0c4d5c538873fa8c22a06452c8efc7c
BLAKE2b-256 checksum
How to use checksums
7d9678d9c3acb1ad2e505827f33b84dfa9f24e7be3839369ec9b38cec28648cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.1

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

Download URL hdbcli-2.20.22-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
4e6ec714daed54faff22d1e484662e1362afbc1bb50c71eec03e50396e69919d
BLAKE2b-256 checksum
How to use checksums
550d4c5305235076205d08bb2f47b3a4ea97e4d94928e0d32db45664cbd7b316
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.1

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

Download URL hdbcli-2.20.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
380ac0eb65e00f3eeb617e3b91faddf872644b5377685138ed92bed7283e76a5
BLAKE2b-256 checksum
How to use checksums
16ea423bbd142fd2958d0de21b87df0fa33c763c2b72f7b4dfe990c9ccd492ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.1

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

Download URL hdbcli-2.20.22-cp27-cp27m-manylinux2014_ppc64le.whl
Size 10.9 MB
Tags CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.17+ PowerPC 64-le
SHA-256 checksum
How to use checksums
a7d33f38113e872cd8d2fb05871a3df78080f80f2d551164be5e355717475ae1
BLAKE2b-256 checksum
How to use checksums
87fc8b51a6e0385087dc74c5741d44e7a572d515fe15a31f1a198e91d1aaee2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.1

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

Download URL hdbcli-2.20.22-cp27-cp27m-manylinux1_x86_64.whl
Size 10.8 MB
Tags CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
a9a455735f27661f326bde3ecdda96b4cbe860018b7fa80f4f1b293d78918340
BLAKE2b-256 checksum
How to use checksums
8f1297f32217e55e280a5c2235c407ba5c7da6587ac52dbaebb2db6e37e5899e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.1

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

Download URL hdbcli-2.20.22-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
e9cd5969c4845e3ade1bbf30438bb63e1b6fbeecd61b6d7b0fb7fd4fd9d4e414
BLAKE2b-256 checksum
How to use checksums
079ca1ff369ac2d253cdfd8b26c8593b6b2b49709557ae91d9165f11d6e070a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.1

Release history Release notifications | RSS feed

This release

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