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

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

Uploaded CPython 3.8+ macOS 11.0+ ARM64

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

Uploaded CPython 3.6+ Windows x86-64

hdbcli-2.19.21-cp36-abi3-win32.whl (3.2 MB view details)

Uploaded CPython 3.6+ Windows x86

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

Uploaded CPython 3.6+

hdbcli-2.19.21-cp34-abi3-manylinux2014_ppc64le.whl (10.9 MB view details)

Uploaded CPython 3.4+

hdbcli-2.19.21-cp34-abi3-manylinux1_x86_64.whl (10.8 MB view details)

Uploaded CPython 3.4+

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

Uploaded CPython 3.4+ macOS 10.11+ x86-64

hdbcli-2.19.21-cp27-cp27mu-manylinux2014_ppc64le.whl (10.9 MB view details)

Uploaded CPython 2.7mu

hdbcli-2.19.21-cp27-cp27mu-manylinux1_x86_64.whl (10.8 MB view details)

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mu macOS 10.7+ x86-64

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

Uploaded CPython 2.7m Windows x86-64

hdbcli-2.19.21-cp27-cp27m-manylinux2014_ppc64le.whl (10.9 MB view details)

Uploaded CPython 2.7m

hdbcli-2.19.21-cp27-cp27m-manylinux1_x86_64.whl (10.8 MB view details)

Uploaded CPython 2.7m

hdbcli-2.19.21-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.19.21-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: hdbcli-2.19.21-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.19.21-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f8607479efef3dea5fc4181806a20ffe6552ef0212efc371c93a15bf2d50c3b4
MD5 f557670282f54c6ddd7b4d6eeb5ff2ca
BLAKE2b-256 f4a8333c896d70c9db71cc71a09a41231f66f6eeefcffdb240a294e978d6728b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.21-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.19.21-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 7c631a467f15cbb0d91655c2059b3c421e2fa0451ffeb500a3461aa4456e3fa2
MD5 c806e5cfe1a5ef41fe1d5ef54dc8c2f9
BLAKE2b-256 a5fb7705eb34fac2cede27c77a31d9d854d099b49de7ca7bcadeee2c0dcd7b91

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.21-cp36-abi3-win32.whl
  • Upload date:
  • Size: 3.2 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.19.21-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 d8529099b535b2c02ddb923ef8006132cf548e358f0bb0afdef3d4d81adc74d0
MD5 6101b221760a9e53c8293db267fb25e9
BLAKE2b-256 fb31543f3bc83315e2f234884f71525dd5d6cb309db460ef2d21e5498f9f98e0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.21-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.19.21-cp36-abi3-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7c7c50e89fe03be434460d407f2b74196eadde21db4046d52175a22b879ffa28
MD5 036e6536cda3cf1b41e9387ec0f82633
BLAKE2b-256 452c32b6622f94f3bda53bc6cfb40eddc3baf2a8b339d73b6a92fcedec3ae983

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.21-cp34-abi3-manylinux2014_ppc64le.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.19.21-cp34-abi3-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 e20a3f60039875d03165c5790993952f5e2ec8efe141e051f7e154d96afc79a4
MD5 2bf799315676c3e34cb0d4ae53fb61f9
BLAKE2b-256 61bc4f68ffe49a213b4904d4d9a151b069cab90f26055c8053b2379c7aafcb45

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.21-cp34-abi3-manylinux1_x86_64.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.19.21-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3c20763ba687acab151680c296c9daddbbbb7107a9790cf953da9bc527e373b9
MD5 9f74037fec34eb93a911b959879b7a17
BLAKE2b-256 222416242b80461ff1c56f114e4c65b8ae595798bae98ba583101a7e14390f4b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.21-cp34-abi3-macosx_10_11_x86_64.whl
  • Upload date:
  • Size: 5.5 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.19.21-cp34-abi3-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 fac185d39a7a143a3c505c3e4260d0fc1b244589d4bea126e248e70e9e994e2b
MD5 74d9b8e0c83c2df0b9f9a8b27883fa3e
BLAKE2b-256 a97ead5efaeb08b3a1cbc1016f91b316a57dfa767d08b2d4e0f01560e24374c8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.21-cp27-cp27mu-manylinux2014_ppc64le.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.19.21-cp27-cp27mu-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 ba5cf42ea026a1b1677c2c8bdbf2e6b77fbbabb7506671485740e675a6a5345a
MD5 90486ea657abf8beadb05599930b5e23
BLAKE2b-256 5fa3fde7e7f0b4abeeb83c70c4277a9fbc19213b8a655ad8820543d30d9c20fb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.21-cp27-cp27mu-manylinux1_x86_64.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.19.21-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9773cc00cfd72ac7c2ad102560ca747bd5077437bed8bbb812071fa0ceb195a2
MD5 4745db780939e7135c1be5d8ad8be502
BLAKE2b-256 8e904da042aabcc408480d02d5dec29933eca2b8609d682711daa32795e5d85a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.21-cp27-cp27mu-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 5.5 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.19.21-cp27-cp27mu-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 98e72291fd5c226b22636274c3ccadb93ff2e3b54b98bff3f37e402ecfd73151
MD5 909160df1396512638d6b43b94e1fd45
BLAKE2b-256 9e3b5a36f77b3c2c3e8a1056dbb15b804c3e90678e58b98e0ad0eb376649e008

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.21-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.19.21-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 c963a8fa2f3405024051812048479bdd527d730351473f354d85e7fd933bf7ce
MD5 ccd923b12742fbf1eed3f95fcc32aaaa
BLAKE2b-256 27354c5bc39360b6ef9c38ecd26860baa92c7ef516f25e55b603e747bb129f60

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.21-cp27-cp27m-manylinux2014_ppc64le.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.19.21-cp27-cp27m-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 a8ceca28c6b80c5e6f8fc80a3517d7e843b9c3288f8b03c49316be68468d3848
MD5 0498da04e33fe10b481f6c8cad7b0352
BLAKE2b-256 c35a43acc491b0716f1ad68678c25da4e49c9e54af12836b563705c321789a24

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.21-cp27-cp27m-manylinux1_x86_64.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.19.21-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f5e5ad76e77eff67ffad4f7db4a9cbe3e6b9c0399e39bd31ffeb4136d2192bc0
MD5 16a139e6d2ee75b7466552037286114d
BLAKE2b-256 d2e7ca7615c56c4b1477ae2871b42c4420a20a913da6fb917c4f9e288b2c21fa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.21-cp27-cp27m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 5.5 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.19.21-cp27-cp27m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 3028f04b86de2d9834a69f3fec2abb58201be3f1cbc357a63af18d4becaab1d3
MD5 4cec7334ad7d2d68ce5064df6a138ef1
BLAKE2b-256 e6af1e3831c95f02ed015a96693153eb895e66d7d1fb23312e2ec48a5c2ba137

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 Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page