Skip to main content

SAP HANA Python Client

Project description

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

Project details


Release history Release notifications | RSS feed

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.22.29-cp38-abi3-macosx_11_0_arm64.whl (5.0 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

hdbcli-2.22.29-cp36-abi3-win_amd64.whl (3.6 MB view details)

Uploaded CPython 3.6+Windows x86-64

hdbcli-2.22.29-cp36-abi3-win32.whl (3.6 MB view details)

Uploaded CPython 3.6+Windows x86

hdbcli-2.22.29-cp36-abi3-manylinux2014_aarch64.whl (11.2 MB view details)

Uploaded CPython 3.6+

hdbcli-2.22.29-cp34-abi3-manylinux2014_ppc64le.whl (11.3 MB view details)

Uploaded CPython 3.4+

hdbcli-2.22.29-cp34-abi3-manylinux1_x86_64.whl (11.2 MB view details)

Uploaded CPython 3.4+

hdbcli-2.22.29-cp34-abi3-macosx_10_11_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.4+macOS 10.11+ x86-64

hdbcli-2.22.29-cp27-cp27mu-manylinux2014_ppc64le.whl (11.3 MB view details)

Uploaded CPython 2.7mu

hdbcli-2.22.29-cp27-cp27mu-manylinux1_x86_64.whl (11.2 MB view details)

Uploaded CPython 2.7mu

hdbcli-2.22.29-cp27-cp27mu-macosx_10_7_x86_64.whl (5.5 MB view details)

Uploaded CPython 2.7mumacOS 10.7+ x86-64

hdbcli-2.22.29-cp27-cp27m-win_amd64.whl (3.6 MB view details)

Uploaded CPython 2.7mWindows x86-64

hdbcli-2.22.29-cp27-cp27m-manylinux2014_ppc64le.whl (11.3 MB view details)

Uploaded CPython 2.7m

hdbcli-2.22.29-cp27-cp27m-manylinux1_x86_64.whl (11.2 MB view details)

Uploaded CPython 2.7m

hdbcli-2.22.29-cp27-cp27m-macosx_10_7_x86_64.whl (5.5 MB view details)

Uploaded CPython 2.7mmacOS 10.7+ x86-64

File details

Details for the file hdbcli-2.22.29-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hdbcli-2.22.29-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a3e3ceed868adf249ed14b55d53750d4fc3c97bacc4cd6d9e046a24d5e957ecd
MD5 703a84bf18df5652dd9627f5b793f529
BLAKE2b-256 3c7a1f575e3ad2f578139a0e588437165263569456a180b9f8882982823ba0e9

See more details on using hashes here.

File details

Details for the file hdbcli-2.22.29-cp36-abi3-win_amd64.whl.

File metadata

  • Download URL: hdbcli-2.22.29-cp36-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.6+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for hdbcli-2.22.29-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 1ede2655d96001e386d704c6c64c9e70dedfee21d0296a3e182885d713d5ee54
MD5 003186d451b40babc85c90578e18df86
BLAKE2b-256 ddec477ee7529f7b58c33e97538bb0a6cac36a8bca3073802c52184721409247

See more details on using hashes here.

File details

Details for the file hdbcli-2.22.29-cp36-abi3-win32.whl.

File metadata

  • Download URL: hdbcli-2.22.29-cp36-abi3-win32.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.6+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for hdbcli-2.22.29-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 495eca6cf308d92635997ad054dfd1cdec14772265109b409d6313d8271e2d6c
MD5 a7518a572d688508d753e2bc79fd2769
BLAKE2b-256 f67bcd5408d994e49dab55b3812cad4dbe3186a4e5d66a09a81a067bb6b91b49

See more details on using hashes here.

File details

Details for the file hdbcli-2.22.29-cp36-abi3-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for hdbcli-2.22.29-cp36-abi3-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 538d1d5cecd26ac6ba15b9c627b177580549800456dc93da9e603d099fca9e67
MD5 0d87d2643bae6c605f03da9c07c4e20a
BLAKE2b-256 15996246e0a4918361db062b330a675a7ad0561d5b699cb93ab0611b7ca18b61

See more details on using hashes here.

File details

Details for the file hdbcli-2.22.29-cp34-abi3-manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for hdbcli-2.22.29-cp34-abi3-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 292cd7bd597024883a553f587b11727fadc0d451d6d6757e40405a63c3431afb
MD5 e88725ba0124d38dd313aebfdfd0ef7c
BLAKE2b-256 19bd6f1c9116a3440274837e69fafd407b3f69d9cf9007165df72871920f1f47

See more details on using hashes here.

File details

Details for the file hdbcli-2.22.29-cp34-abi3-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for hdbcli-2.22.29-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c70ae254bf1565137812943f8f68595e7142e0b4ea53d7d8b5b9c233fae935a0
MD5 fa77af7cc9f524b8bcf0dd5dd9094762
BLAKE2b-256 ab50956783553848f4f5abed4c9cd04d78e2d5a1032a59cd74d5b680585df632

See more details on using hashes here.

File details

Details for the file hdbcli-2.22.29-cp34-abi3-macosx_10_11_x86_64.whl.

File metadata

File hashes

Hashes for hdbcli-2.22.29-cp34-abi3-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 5e7433ab9e83dffc7028b34b2c5171e8dbbe7a24cfbc46c257dd5b729809781a
MD5 de5a8ef048013ee580c36c647283bf74
BLAKE2b-256 85c7c4746cdeefbb39e5178cb8cb8ef20857464c8cc2d1210f2682c35aa32d60

See more details on using hashes here.

File details

Details for the file hdbcli-2.22.29-cp27-cp27mu-manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for hdbcli-2.22.29-cp27-cp27mu-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 712c6541e7d1886d7883b019352c0ad1cba02342022dcf4a877383ee1981a11e
MD5 2127893eca2608525b85ba3a61ce862a
BLAKE2b-256 346c8a24255b9e04f20b02ee7d1d00df4f8753ff9ea97cd34b6503641311a2dc

See more details on using hashes here.

File details

Details for the file hdbcli-2.22.29-cp27-cp27mu-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for hdbcli-2.22.29-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 2c508303675bfe58a39e39ad447f07e31f93e006aa357b8ddd8e87e5e1ffb43d
MD5 3d5ba9ff7b67f3d61b1191618ad5f1f7
BLAKE2b-256 f2d3ac22060bf46c797800201840eae23f01b27d60e29dcc56945787c19f6ca7

See more details on using hashes here.

File details

Details for the file hdbcli-2.22.29-cp27-cp27mu-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for hdbcli-2.22.29-cp27-cp27mu-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 373c97dc15833a954cbd8dd5790c6da8a375ca8703bb7e6183e54b3dbcaf74a3
MD5 3cd548014ab6ec07164221fefcc8976d
BLAKE2b-256 b318951d591f0706edd4fc01e15e190faf713943ad12f3f7a9f788b248cce183

See more details on using hashes here.

File details

Details for the file hdbcli-2.22.29-cp27-cp27m-win_amd64.whl.

File metadata

  • Download URL: hdbcli-2.22.29-cp27-cp27m-win_amd64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 2.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for hdbcli-2.22.29-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 9280fd256a5f128510f184e0339e396570674fbf86d329f423b838fdbba485d6
MD5 bdd953e50bcfce696d28267a792b71e4
BLAKE2b-256 b29cf781a4e5c0b8b7b4b0866644885b8824550da34c8ff9ac06e60d906587ba

See more details on using hashes here.

File details

Details for the file hdbcli-2.22.29-cp27-cp27m-manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for hdbcli-2.22.29-cp27-cp27m-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 3a39c06c191892440d2f83234663ff27c68478ec9825a0da433c4539c5a2fea6
MD5 e207e9c62032da166cb3a3e7f39f41f0
BLAKE2b-256 d2b94afb0a36e89d5a1aa5676884fc128e73b7db3af3ce34fd9257d39f23ef8b

See more details on using hashes here.

File details

Details for the file hdbcli-2.22.29-cp27-cp27m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for hdbcli-2.22.29-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 01f64d8c6e367fcf4f7c647169611f980e1416f98533ae6d6bdec2b230c1d216
MD5 b67b1470389d2f103ecad0f95a1a183b
BLAKE2b-256 002e44a66014031625f7206924cc020946ab0151e25317aa12246b1b3c9d749c

See more details on using hashes here.

File details

Details for the file hdbcli-2.22.29-cp27-cp27m-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for hdbcli-2.22.29-cp27-cp27m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 74f5455c4b3e91d1df19bd99ed73180836731c860707099f9c44bef262bc2da4
MD5 2d19f1a3099d0f0e5e7eb54cc39b7098
BLAKE2b-256 ace58abd0badae671388994d92ff8af44c1b4dfbe544df79feb92274c26acc50

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page