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

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

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

Uploaded CPython 3.8+macOS 11.0+ ARM64

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

Uploaded CPython 3.6+Windows x86-64

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

Uploaded CPython 3.6+Windows x86

hdbcli-2.18.22-cp36-abi3-manylinux2014_aarch64.whl (10.7 MB view details)

Uploaded CPython 3.6+

hdbcli-2.18.22-cp34-abi3-manylinux2014_ppc64le.whl (10.8 MB view details)

Uploaded CPython 3.4+

hdbcli-2.18.22-cp34-abi3-manylinux1_x86_64.whl (10.7 MB view details)

Uploaded CPython 3.4+

hdbcli-2.18.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.18.22-cp27-cp27mu-manylinux2014_ppc64le.whl (10.8 MB view details)

Uploaded CPython 2.7mu

hdbcli-2.18.22-cp27-cp27mu-manylinux1_x86_64.whl (10.7 MB view details)

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mumacOS 10.7+ x86-64

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

Uploaded CPython 2.7mWindows x86-64

hdbcli-2.18.22-cp27-cp27m-manylinux2014_ppc64le.whl (10.8 MB view details)

Uploaded CPython 2.7m

hdbcli-2.18.22-cp27-cp27m-manylinux1_x86_64.whl (10.7 MB view details)

Uploaded CPython 2.7m

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

Uploaded CPython 2.7mmacOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: hdbcli-2.18.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.18.22-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 11df352a21ba2bdecc859df821bfcb340cc5f30b02b4d900d0e48f1f44a27b6b
MD5 8f9ee7af745f55be0475c9e26e6699a4
BLAKE2b-256 aee4a27f0a7b280e72b4a67d2e4b0a74db0253a2c04bfb3c75a224211bcdc338

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.18.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.18.22-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 60a07240a7a3e1da2ecd5820b85addc5a42873acf4e1fa78185fd324044f945f
MD5 2ed2ef80d40a635f94026b70c828ce3a
BLAKE2b-256 2be4da3f1e17f332552b2f327cc3a189b7faf91d18571393003d0e28b87c1507

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.18.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.18.22-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 aadc4424861ba81e5dbe4a5ffac0425672766f6029542ca7588e2f154059d912
MD5 d8a60343a9e6ec8fa757ca843d5751d3
BLAKE2b-256 1423e358a1603add7f19816545f3373e2d596d9978cbfd1e35739862f1dfe8a8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.18.22-cp36-abi3-manylinux2014_aarch64.whl
  • Upload date:
  • Size: 10.7 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.18.22-cp36-abi3-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fa15311dbfc7ec86b2b033d8b581208b53fdf070b8fe41c7a5c5fe4dea324b8b
MD5 fe5eb8992b86ab1eb53122569a031f2d
BLAKE2b-256 4f75ef2c75a23af209d0f19fba707dadb8e7f9b5acbd120cc08e54a8e0615001

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.18.22-cp34-abi3-manylinux2014_ppc64le.whl
  • Upload date:
  • Size: 10.8 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.18.22-cp34-abi3-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 974eb9a4226d6e0f692ae4bd826a2f37b0293a72f8859651af86857103d1b850
MD5 633e6d566a1666a941d36a8df952a336
BLAKE2b-256 26a1aaef11e20688f64d2cbdd435e7dd20a3937f52eea000ff876a7b4c59f2eb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.18.22-cp34-abi3-manylinux1_x86_64.whl
  • Upload date:
  • Size: 10.7 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.18.22-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 011f8b39b8237290ec28bbd21060e39d208e7392cbba468840664c338dca27db
MD5 04c849618d8e76f1c2f74ec65b68fbae
BLAKE2b-256 a82b784524c9ead5c489a409f83b4ae2f305aa3a9b8e47f4a9ea8a3b9a0dcab1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.18.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.18.22-cp34-abi3-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 0b06622a2db3d25b6d1471b44c602bbe251fdff3ef375c9919b273e6258b08df
MD5 e3127ee8953f7c8336ed2ac98e9b9877
BLAKE2b-256 d297b4ef105c94813e951ca0c49cff9ad67be09bf322368f7dec4c805e0150a7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.18.22-cp27-cp27mu-manylinux2014_ppc64le.whl
  • Upload date:
  • Size: 10.8 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.18.22-cp27-cp27mu-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 b5e38da5ae618e2cc4bb7abf835a4f75c451fa7392c3d9412f7102e13abc6607
MD5 2a4325257a659cdb33a40ff8f11b96b4
BLAKE2b-256 1f4e6367a89617cf4e9a8d2383fb0945824780e3579f64297603752c38afbcdf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.18.22-cp27-cp27mu-manylinux1_x86_64.whl
  • Upload date:
  • Size: 10.7 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.18.22-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 05dee290313266aa1e216dc2611a04f8a84bd2171f4d63abf7030dcd03af7a32
MD5 de11515f2073823e98e980c054090852
BLAKE2b-256 f33b04be6c0cc92cc7d4281adc50248683920c3d4414d43a277c0a53ba62857d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.18.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.18.22-cp27-cp27mu-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 3e034f82574d204c8a58c2524fc3c962df9090f2ecdd931ebde88ebdb00fde49
MD5 15b07a4fa5da366cf82af9cc88beb72b
BLAKE2b-256 f6642dceaef36dd5991440f06deb5162f58c0fb4c93417e749fbbf9666bd2621

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.18.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.18.22-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 8bf810f629fe0d9f1fbc70c2c1fc5061ebe3e419f3889cd31ccbf1d1dd08f3b1
MD5 386ed75dc6aed8109e49a633fdeb91d8
BLAKE2b-256 588299b0ec994c94f0dc4ee9e29ea039bc182c36cdd2eb7834b0d2371605b56f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.18.22-cp27-cp27m-manylinux2014_ppc64le.whl
  • Upload date:
  • Size: 10.8 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.18.22-cp27-cp27m-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 1f3781f17196ed461fe5f59092854fe22f0e9c683d8e26dee92042c01dfcd34a
MD5 33d1ced3dd98fbe86679d1e1707e1a4f
BLAKE2b-256 1294b5581941f180f1f4b3b2557d8634fec6ba8f2e48ea652b2bdae6e2026ec4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.18.22-cp27-cp27m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 10.7 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.18.22-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5dbc5d6f3573827fcb9a5e8f18185c2e8e813e7fd64efcf7a511fa9a20a1a9cb
MD5 e5e9a52abd93a136038ab54b23695f91
BLAKE2b-256 d82b5bc175ddb068c8a518f64d62b57b3e1d6ea717e7e9d66b8ca5b53da96dc2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.18.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.18.22-cp27-cp27m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 7670de42c4afc76cb3c9a3e91f5712a08848ffd6b37d3ae447061acceeb24439
MD5 92cd7c625495c2a7744d568b42925f6a
BLAKE2b-256 c4867fae8b821c9432ca4f9f2ba4cd210b9724839705b3099a02efdcd1e7d03a

See more details on using hashes here.

Supported by

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