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


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

hdbcli-2.22.32-cp38-abi3-macosx_11_0_arm64.whl (5.0 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

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

Uploaded CPython 3.6+ Windows x86-64

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

Uploaded CPython 3.6+ Windows x86

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

Uploaded CPython 3.6+

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

Uploaded CPython 3.4+

hdbcli-2.22.32-cp34-abi3-manylinux1_x86_64.whl (11.3 MB view details)

Uploaded CPython 3.4+

hdbcli-2.22.32-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.32-cp27-cp27mu-manylinux2014_ppc64le.whl (11.3 MB view details)

Uploaded CPython 2.7mu

hdbcli-2.22.32-cp27-cp27mu-manylinux1_x86_64.whl (11.3 MB view details)

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mu macOS 10.7+ x86-64

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

Uploaded CPython 2.7m Windows x86-64

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

Uploaded CPython 2.7m

hdbcli-2.22.32-cp27-cp27m-manylinux1_x86_64.whl (11.3 MB view details)

Uploaded CPython 2.7m

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

Uploaded CPython 2.7m macOS 10.7+ x86-64

File details

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

File metadata

File hashes

Hashes for hdbcli-2.22.32-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 261ab5ce149f496a93a8127183f00d9baea70f4b28f06f15599f0e95dcf1a0e4
MD5 52c0ffb81ae6c081404af4ca322e1dac
BLAKE2b-256 73a063d8011997bd4b32b94ee5f29aab170ad830c645c640037cba61a797583f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.22.32-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.32-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 486375fac0c83302256408ecc1aaaababf123e5a1092f4835909e156d264c6b5
MD5 55996009e98b9590fd80d96dfc94cbcb
BLAKE2b-256 3ea55f1d4e0d19c121d0bfaed2aba2858394ff5ef907654246a7b14e001d3e9a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.22.32-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.32-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 5340c085ee4c4299b50eab7a150e1c6eeefc0afd2bdc77b2fe08b2518f784461
MD5 65bc6330895434e46bd6660ae0daf96b
BLAKE2b-256 b93ece3dede10f93e7738fd528ed7bd1e69842038c6812e43db3ec06ca620f98

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.22.32-cp36-abi3-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c585a605c38b924be7245e723415febde70b3d0fd61a80ec7a907d23926e7844
MD5 a933a7d399d3da109d38e40683259d86
BLAKE2b-256 9906a174144933cc743d5e20c6879b58e34c7f4ff50c45cda3d052abae254179

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.22.32-cp34-abi3-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 387b42834293f72d55bc104b1e43fd7a89e11be0fab02ad748f5132a561e03f6
MD5 e49575ba3fcfbfa4838962481510b462
BLAKE2b-256 bb3020b2e73679946d76b5054e0a655324ef449b00f2afec696d5285d0876d67

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.22.32-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e36dac44bd847c284efb42c6bffbe0fd565d218731b0045b4980b5de3238485b
MD5 7a89bb1ddda03a05c26be80c37a690a6
BLAKE2b-256 35ac52ef881927896f3a3c027a83071763b8f24321618027b70130f9f59b998e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.22.32-cp34-abi3-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 5dd02ab6aebfcb87b1bb526528afa54377685bb2e525eb82639858151edc7fe4
MD5 73e2d5652d979a0edd1a3ba451fac503
BLAKE2b-256 b4f9dddd0d885c0eec2743230a66d0a8b233019590b1846799cdbc26e0c067ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.22.32-cp27-cp27mu-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 b771631cefa973c9a942507ec1ca35036566c152e2df530e37aaece1dfc9cc41
MD5 3468d164dcdd799cd209dd8e7d2b9c36
BLAKE2b-256 685937a8b983f67efc19f8cd9e0cb0de3758d659cb00b6b3af89db038f047909

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.22.32-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 eec899375a338bb98db3c84190858126688ad690a65ad4de8434d0388163ab89
MD5 888b27c8ce3320410d9176fc99adaa62
BLAKE2b-256 5c94d7c82a6e4d07ed124d3e4a23fcd80fd6d9f15590915593aa57e50ec3f6a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.22.32-cp27-cp27mu-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 683209604beb5d184cc6ead75d6fd4fdb3a8650a48cd4f3032fcee5a849a5767
MD5 43948cdb74fbf54be2ba9d3364e161c7
BLAKE2b-256 2ad1f6765399228e84b541c8320b3cbd3ab8329b8873a04eaa9206600fbafd09

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.22.32-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.32-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 f088d71218429ed03c3b3b8b02b4cfd6b181bbdb814816081f0fca61034b5791
MD5 1ddccee0e48f1e653294bb41a61e73be
BLAKE2b-256 278c8ebff807e24f2c7f8e38c5a6d2a24af8ea9b70653ab888cd4dc496da7777

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.22.32-cp27-cp27m-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 6cdad89ae1540cb3ddf5e08f4174cef3213de7a5b0ef4d4fd5d48e43fbac9232
MD5 a064f4ad7d00dcd87fc35514db6ccbe0
BLAKE2b-256 572fefac530011096083508b9ea1e4a55dcb9922a2f7b6892aeacfc883357563

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.22.32-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 bc65dc303dfadc2029e474891def08f46a7f846e6b20efe76d665e5849bf35a5
MD5 95028e727bd484f82b95612022adcd05
BLAKE2b-256 dccfc9ede6adca5ffdc7573879eccdaeb62b6e06c4a21eb2cb6335a9a3b34719

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.22.32-cp27-cp27m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 1ada555cabe820a8f25ab11404529c7577ff720d713186b944e0134fea2ddc57
MD5 61be19acaa4834edbf21b8c2aaaa8d8e
BLAKE2b-256 02b6a16c8500c3b955d5f7b058e690fcc729942794909d9aa834e1219b64f518

See more details on using hashes here.

Supported by

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