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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

hdbcli-2.29.27-cp310-abi3-win_amd64.whl (3.8 MB view details)

Uploaded CPython 3.10+Windows x86-64

hdbcli-2.29.27-cp310-abi3-win32.whl (3.4 MB view details)

Uploaded CPython 3.10+Windows x86

hdbcli-2.29.27-cp310-abi3-musllinux_1_2_x86_64.whl (5.9 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

hdbcli-2.29.27-cp310-abi3-manylinux2014_x86_64.whl (5.8 MB view details)

Uploaded CPython 3.10+

hdbcli-2.29.27-cp310-abi3-manylinux2014_ppc64le.whl (6.1 MB view details)

Uploaded CPython 3.10+

hdbcli-2.29.27-cp310-abi3-manylinux2014_aarch64.whl (5.5 MB view details)

Uploaded CPython 3.10+

hdbcli-2.29.27-cp310-abi3-macosx_13_0_x86_64.whl (5.7 MB view details)

Uploaded CPython 3.10+macOS 13.0+ x86-64

hdbcli-2.29.27-cp310-abi3-macosx_13_0_arm64.whl (5.2 MB view details)

Uploaded CPython 3.10+macOS 13.0+ ARM64

File details

Details for the file hdbcli-2.29.27-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: hdbcli-2.29.27-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.8 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.1

File hashes

Hashes for hdbcli-2.29.27-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 88fe24a89dd13d8bad6db9d28d971033af581b85051b5326c8a4f86e75d42559
MD5 750e1b20b4bd22812e8b9f932ccf8b86
BLAKE2b-256 ddda705ef4a535d74064d0cd7c879dbadecb791550c1ce59a441c8c6e6bcc2f2

See more details on using hashes here.

File details

Details for the file hdbcli-2.29.27-cp310-abi3-win32.whl.

File metadata

  • Download URL: hdbcli-2.29.27-cp310-abi3-win32.whl
  • Upload date:
  • Size: 3.4 MB
  • Tags: CPython 3.10+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.1

File hashes

Hashes for hdbcli-2.29.27-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 a0e5e77f5f892a9409dd3b0ad64aaf4ad726d55c5f784cb508d070b64d68c905
MD5 bf86c8d17f14923ed1ce3c6c6f071312
BLAKE2b-256 1129a9fe29ef382f9cbbd31e7643044ca5e0b8c3defda4e738d7400185865580

See more details on using hashes here.

File details

Details for the file hdbcli-2.29.27-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for hdbcli-2.29.27-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a3d12d56658ee3a89e27cfba907ccba17cdfe012e9a6da8bbfe32116aedd796a
MD5 4abca75e0ba27d06c36ab109e67bb76e
BLAKE2b-256 9f4a911a9f7953c2653cd7abfa3f38cf08313d5cba04cc1fe8146b10be5fc2f7

See more details on using hashes here.

File details

Details for the file hdbcli-2.29.27-cp310-abi3-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for hdbcli-2.29.27-cp310-abi3-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 95591da2ff6d3ae6ffa69cddd2b2d73523cadf7da880a8cd966f984b35523cff
MD5 cbcb91cb1f7208c279d1873bfe4b966d
BLAKE2b-256 c7cc45d10e76a98e1f6b8c5f3ab1ac700f123f3f6fd61fbbb847a90367123c42

See more details on using hashes here.

File details

Details for the file hdbcli-2.29.27-cp310-abi3-manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for hdbcli-2.29.27-cp310-abi3-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 22c3779a92480ae74e785a4acfe9072b1fc517c3749d3d8c0fafec54dafb1634
MD5 66aa7c3bdb3d47a83c7a90e83bacd91b
BLAKE2b-256 b5dee17c9f452d7c6fd4ab031d2ceb8a23fbb4468554259a521ca44631cbde08

See more details on using hashes here.

File details

Details for the file hdbcli-2.29.27-cp310-abi3-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for hdbcli-2.29.27-cp310-abi3-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ab91d1ad921e7cf0d5962646bfa5f7b496546f1b2702dd9270ce6e01abac963e
MD5 feeaec6e3bc36b8dfda05df3c70e7d64
BLAKE2b-256 a78ffa73fe00fb7df413e172621d41dab13cc8d97454a427c2343d5e0724f593

See more details on using hashes here.

File details

Details for the file hdbcli-2.29.27-cp310-abi3-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for hdbcli-2.29.27-cp310-abi3-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 ef090c86b70910d35147c54fc9f87e06040a759aaeae7c810e319dfdd0ed13f6
MD5 c1322810657bb6e5ea0cdcbdbff72f5e
BLAKE2b-256 b4a6c60d52a2cde49d2c26ff14e1cd6da6d525cfcf12ff542a034cc0db1ea7e4

See more details on using hashes here.

File details

Details for the file hdbcli-2.29.27-cp310-abi3-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for hdbcli-2.29.27-cp310-abi3-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 338be359ea95fb2188c3a15dfeb67ba5a063532497476967d9580c3b0ad94ef0
MD5 ab3423531e4aea5a7ff378cfac7504c6
BLAKE2b-256 283d47cf72139a8fa098bce7c08cbcffcfbc63081b74b5991bee9bd7858f1ec8

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.29.27 This release

8 files

2.29.25

8 files

2.29.23

8 files

2.28.22

8 files

2.28.21

8 files

2.28.20

8 files

2.28.19

8 files

2.28.17

8 files

2.27.24

8 files

2.27.23

8 files

2.27.19

8 files

2.26.26

8 files

2.26.25

8 files

2.26.18

8 files

2.25.31

8 files

2.25.29

8 files

2.25.22

8 files

2.24.26

7 files

2.24.24

7 files

2.24.21

7 files

2.23.27

7 files

2.23.26

7 files

2.23.24

7 files

2.22.32

14 files

2.22.29

14 files

2.22.27

14 files

2.21.31

14 files

2.21.28

14 files

2.21.26

14 files

2.20.23

14 files

2.20.22

14 files

2.20.15

14 files

2.19.21

14 files

2.19.20

14 files

2.19.18

13 files

2.18.27

14 files

2.18.24

14 files

2.18.22

14 files

2.17.22

14 files

2.17.21

14 files

2.17.14

14 files

2.16.26

14 files

2.16.21

14 files

2.15.22

23 files

2.15.19

23 files

2.15.17

23 files

2.14.24

22 files

2.14.23

22 files

2.14.22

22 files

2.14.18

22 files

2.13.22

21 files

2.13.21

21 files

2.13.13

21 files

2.12.25

21 files

2.12.22

21 files

2.12.20

21 files

2.12.13

19 files

2.11.20

19 files

2.11.14

20 files

2.10.20

20 files

2.10.15

20 files

2.10.13

20 files

2.10.9

20 files

2.9.28

20 files

2.9.23

20 files

2.9.19

20 files

2.8.22

20 files

2.8.20

20 files

2.8.16

20 files

2.7.26

20 files

2.7.23

20 files

2.7.21

20 files

2.7.17

20 files

2.7.16

17 files

2.6.64

16 files

2.6.61

16 files

2.6.58

16 files

2.5.111

16 files

2.5.109

16 files

2.5.105

16 files

2.5.101

16 files

2.5.86

16 files

2.4.202

13 files

2.4.194

13 files

2.4.191

13 files

2.4.182

12 files

2.4.177

12 files

2.4.171

11 files

2.4.167

11 files

2.4.162

11 files

2.4.155

11 files

2.4.151

11 files

2.4.142

11 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