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

hdbcli-2.17.22-cp38-abi3-macosx_11_0_arm64.whl (5.2 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

hdbcli-2.17.22-cp36-abi3-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.6+ Windows x86-64

hdbcli-2.17.22-cp36-abi3-win32.whl (3.1 MB view details)

Uploaded CPython 3.6+ Windows x86

hdbcli-2.17.22-cp36-abi3-manylinux2014_aarch64.whl (10.8 MB view details)

Uploaded CPython 3.6+

hdbcli-2.17.22-cp34-abi3-manylinux2014_ppc64le.whl (11.0 MB view details)

Uploaded CPython 3.4+

hdbcli-2.17.22-cp34-abi3-manylinux1_x86_64.whl (10.9 MB view details)

Uploaded CPython 3.4+

hdbcli-2.17.22-cp34-abi3-macosx_10_11_x86_64.whl (5.6 MB view details)

Uploaded CPython 3.4+ macOS 10.11+ x86-64

hdbcli-2.17.22-cp27-cp27mu-manylinux2014_ppc64le.whl (11.0 MB view details)

Uploaded CPython 2.7mu

hdbcli-2.17.22-cp27-cp27mu-manylinux1_x86_64.whl (10.9 MB view details)

Uploaded CPython 2.7mu

hdbcli-2.17.22-cp27-cp27mu-macosx_10_7_x86_64.whl (5.6 MB view details)

Uploaded CPython 2.7mu macOS 10.7+ x86-64

hdbcli-2.17.22-cp27-cp27m-win_amd64.whl (3.5 MB view details)

Uploaded CPython 2.7m Windows x86-64

hdbcli-2.17.22-cp27-cp27m-manylinux2014_ppc64le.whl (11.0 MB view details)

Uploaded CPython 2.7m

hdbcli-2.17.22-cp27-cp27m-manylinux1_x86_64.whl (10.9 MB view details)

Uploaded CPython 2.7m

hdbcli-2.17.22-cp27-cp27m-macosx_10_7_x86_64.whl (5.6 MB view details)

Uploaded CPython 2.7m macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: hdbcli-2.17.22-cp38-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 5.2 MB
  • Tags: CPython 3.8+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.17.22-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 57a1d75ad947623c0509f888e6c6a17ecb74be59d285a76d360188db2415acc2
MD5 6df8f3c13a893b360bdcfa2195d61c9b
BLAKE2b-256 a8c0522ea99efcc21b678ccf2c9da5889d19dc5b788e3f2fae340dcd1bc4a96c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.22-cp36-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.5 MB
  • Tags: CPython 3.6+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.17.22-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 67be33b39694536b9174de14b3aead95a7c903cae8125f9f6af55f0911e3fff2
MD5 9e5513a83654a273093c834f2b97e3ac
BLAKE2b-256 1fd66c6381917c178b8998a686be396e0adce1222671a485dd3021e9346267bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.22-cp36-abi3-win32.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: CPython 3.6+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.17.22-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 d2358c1001afd4630a75282aba167b71beb620281329c5183f28f048439f17b4
MD5 8f172cb71cefb14bbf06def798b991b2
BLAKE2b-256 d82ec5d072f35502fb0b55847ed54f31474c39b53d469d5a236d24ffe9df0bf3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.22-cp36-abi3-manylinux2014_aarch64.whl
  • Upload date:
  • Size: 10.8 MB
  • Tags: CPython 3.6+
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.17.22-cp36-abi3-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 19bf061c0e78afe18229684cc0674d33e0e641a0444605e31fcc3be2894ffe3c
MD5 c1085526fa2dad0193fc13e0e1900553
BLAKE2b-256 d7d06d3b5b13f6f0eabc016c48628aa37262afc8b82347439aab48e40753afb4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.22-cp34-abi3-manylinux2014_ppc64le.whl
  • Upload date:
  • Size: 11.0 MB
  • Tags: CPython 3.4+
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.17.22-cp34-abi3-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 4499ee6f1ac1223fc18ae52c43910d2ceb5ea291eac0351d000e4f44fff0722d
MD5 0a0662b042e1f412dc50c9c3832de5de
BLAKE2b-256 dfd5ce5ee7d2af629ff48ec9160cb00f4cf33d1fb55bc1f6842c40c9ed8d4199

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.22-cp34-abi3-manylinux1_x86_64.whl
  • Upload date:
  • Size: 10.9 MB
  • Tags: CPython 3.4+
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.17.22-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 89a93c95c3219b5b624151b1eea39fc5ff11159621ddafb29526f2b2386b4220
MD5 653e38beffd4066695761809799c4baf
BLAKE2b-256 4efe374ef93b1b15c2368842d7794f3a34fe1e99f7d52f86b18b11409adf1c0d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.22-cp34-abi3-macosx_10_11_x86_64.whl
  • Upload date:
  • Size: 5.6 MB
  • Tags: CPython 3.4+, macOS 10.11+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.17.22-cp34-abi3-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 91bef24505b62731c4249925341efd23d1d486cbaa6e883a2d0328bf31181c9b
MD5 f5f7791bd681dbdfa6f9760d2dba16b3
BLAKE2b-256 c7d189ab04c3b4c7aa23dcae2e3546cbea480a3b2820a93bd85b170a4cbc1ddb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.22-cp27-cp27mu-manylinux2014_ppc64le.whl
  • Upload date:
  • Size: 11.0 MB
  • Tags: CPython 2.7mu
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.17.22-cp27-cp27mu-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 ef97d43e923b93ef597dcb009d378e47c923e8c22f486d3156032eb3d8b27862
MD5 af3b50f24f5f6983c4ac0a15911fb997
BLAKE2b-256 e211bfb5c5ababdf386519eb3f08a3206dad5008171d992777a40a23451d8f74

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.22-cp27-cp27mu-manylinux1_x86_64.whl
  • Upload date:
  • Size: 10.9 MB
  • Tags: CPython 2.7mu
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.17.22-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ceeeacb9050195d9b0184b899cdd61e9d3a54ce286f41fc85fd92e9548028cdf
MD5 ee33653741d94620a2b8842115bfe6c9
BLAKE2b-256 d4de58e86f7883cfb32c6dc285585e08a01e1bf835d1dc1b395b17e66411e869

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.22-cp27-cp27mu-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 5.6 MB
  • Tags: CPython 2.7mu, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.17.22-cp27-cp27mu-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 e936f108f7c540eab2c0c88755e8b42a03e8d4e4e38a6f7e7ee81d5c7b3fb039
MD5 3cade8deef7e9d20ff4d89161701ae0b
BLAKE2b-256 74377a598d5790046766e571dcb35f044f2c859ed656b2049bd1914b1c18edcb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.22-cp27-cp27m-win_amd64.whl
  • Upload date:
  • Size: 3.5 MB
  • Tags: CPython 2.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.17.22-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 c644779c6b376a2cefaeb8f1aab2adc6a55f24e64106a1658ad3ff48aaecd051
MD5 6c129adc89f0ab1872ed95af8364a779
BLAKE2b-256 72a4773c79155788b83f5464d75391ccac7896eae8837454cd36da8a1be2b747

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.22-cp27-cp27m-manylinux2014_ppc64le.whl
  • Upload date:
  • Size: 11.0 MB
  • Tags: CPython 2.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.17.22-cp27-cp27m-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 d2b8ac563aa481f54ea753ec0f1105bc9614a3ab1650d1ddd525c6a1109cac50
MD5 bc4c99fa6bb00de54e4aff4ab05ce64b
BLAKE2b-256 0d6a07801b308a01d0b0cafb61636119a6f1ec8e70e32f06c5e43fa5c5eb5209

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.22-cp27-cp27m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 10.9 MB
  • Tags: CPython 2.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.17.22-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 08e24fc071c357ec68938eda3641373a2b763f62da5e6dfe1ab563069aa17e0f
MD5 730e9c6c94ae5479d1d0530d512f68a9
BLAKE2b-256 6dccd113119228c26e8221b807c0d1973f62a5f5b260529c9d116ea1e4c3f3f3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.22-cp27-cp27m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 5.6 MB
  • Tags: CPython 2.7m, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.17.22-cp27-cp27m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 ef7d6e99796c09696bf89f431b3acee2197253d03ec802566d66888127bbeaab
MD5 da116216e96ae535490fb29c5b2f85eb
BLAKE2b-256 c840931f7deb1b7c1546bee729d3426f389d71f93916de16b5ab7c5ce14e44b3

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