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

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded CPython 3.8+macOS 11.0+ ARM64

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

Uploaded CPython 3.6+Windows x86-64

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

Uploaded CPython 3.6+Windows x86

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

Uploaded CPython 3.6+

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

Uploaded CPython 3.4+

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

Uploaded CPython 3.4+

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

Uploaded CPython 3.4+macOS 10.11+ x86-64

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

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mumacOS 10.7+ x86-64

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

Uploaded CPython 2.7mWindows x86-64

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

Uploaded CPython 2.7m

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

Uploaded CPython 2.7m

hdbcli-2.16.26-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.16.26-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: hdbcli-2.16.26-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/0.10.1 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.16.26-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a554ba8b7cdc1bd750dfba802131b470a5f29ff0df3ae8f996ce1051cd57b94f
MD5 e54692585b7cbbd899c3b181af705212
BLAKE2b-256 b27d0c1d6e4c0be3ae3050e59ffb2f396eba8de2f01a2234893f5e3535668141

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.16.26-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/0.10.1 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.16.26-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 beca9789b582fafcc35fd2e3536bf482a23f2e862e3f0e5aa30f39d8392397be
MD5 88a57932e05d5adac7301e688726ef3f
BLAKE2b-256 f238d98c2455e79f7449c7a860de1a9d4cd548740858e665a1590f61a08d40a7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.16.26-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/0.10.1 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.16.26-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 600591caec7481d6b0942b259922581ca6e479afa612c1e5b94c7b721aa6001c
MD5 64019bb38391dfadae20332b8e401404
BLAKE2b-256 7d2cc24146120307dc4533d79e1f66b0ade09675c92bf1bb362131dd76310e99

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.16.26-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/0.10.1 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.16.26-cp36-abi3-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c8867d244480cda30dbb24c1d14c2e5aae3ca051d282263d5c3b420aaba7a4b6
MD5 500b1ce2f2cf0a7decb6b8d02f563415
BLAKE2b-256 3c9cbf02bcea96116d3a297691a3d4b4a367e0f5a2186a177d37ccdbfd9718d8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.16.26-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/0.10.1 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.16.26-cp34-abi3-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 b4b29a29286c15c083b4924f42d571c35173dc95c4fb041926c4d6d56252fd0d
MD5 cd65764717bbf6d36f040ef81c1fbfe7
BLAKE2b-256 8b0ae9679ce1e8ffa550ceab0ed0ceb3d33eee6d520e8a9a47528c0955707ccb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.16.26-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/0.10.1 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.16.26-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a65be799c470a65693f04609dbdf1f8321f374590797f8214d969943e7a226d6
MD5 7648491f1540aeed8a27d25647884b2b
BLAKE2b-256 139bd179503ea32a075c1b984cf205d7ffafbf60e5ed4269fae2412fe148134f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.16.26-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/0.10.1 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.16.26-cp34-abi3-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 4985b600152ef5242dbb0fa9b6619eac19ead5501dbbbdbd29acd09c6cffd4d4
MD5 544b0ae8ef3bebae927e7ded8599ec72
BLAKE2b-256 87bcf0c91852427a94e32cc6b2c8d0b43ef9a8a801e3f85c098cd2319c022bd0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.16.26-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/0.10.1 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.16.26-cp27-cp27mu-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 14cfc86681949cbda6ca1161b7ddad2acaefd59a9ccf8fa93f61ef75fb4e6442
MD5 031b601e383363919250a20bef0755bb
BLAKE2b-256 16aa862ebd9cb19a2dc749b8574576b46bc72a3e6dd5b685a8c93c1c516ebdd3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.16.26-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/0.10.1 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.16.26-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5cfbfafc853f28e01467666980fb874c3d1f2a52138d5ed63712d7d05ca1c25e
MD5 536d10f881084f0118b7e1e8237959b2
BLAKE2b-256 65a0124fb0065e5d8d907328730fb19aaa74b14b779265cfd005510a4331956b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.16.26-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/0.10.1 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.16.26-cp27-cp27mu-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 53823a581ea995666e7b36d2460c2e78cfff13166f3003128b1fdb54c78d9e5e
MD5 22b193ba9cca6541616fece59f1ca2c8
BLAKE2b-256 26e0fe09e6662761319bbc2ed50bee747539b6393596be6336ebe3c457f4b145

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.16.26-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/0.10.1 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.16.26-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 4c18d1ce2761ed6c2abb9e357ead8ac6d7b6e39c21d2c3293c1a64afd07e1d0f
MD5 0f33a6c129dafb32a5f938989c102667
BLAKE2b-256 4e7d861dcfd0e04e78dde0da5c4da541cb95267e0e552f53b86fefb9af29d73a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.16.26-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/0.10.1 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.16.26-cp27-cp27m-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 34192ee0d8514fd4e183a7a40189a897caa03c5538432fcfa9f6ae3cd207184f
MD5 bae29e4442de360728ffae19735384ea
BLAKE2b-256 3359aef2435c1629be78f2577d159f61d56a6b6a359fc5227c1cf2c0ee9cf6d7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.16.26-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/0.10.1 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.16.26-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a0248726e611d50c5ffdc6d27408156fba3d78a8c40421391aa85392a0ef6a5f
MD5 9b1f968c658e90086933a5cd8cb17a5e
BLAKE2b-256 1d9a2a7035f915f96415a5936381934980c3edb24029c0d370d3935420950133

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.16.26-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/0.10.1 tqdm/4.64.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.16.26-cp27-cp27m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 4b7784309854e70e8cce90b6031f7a2c03e7be365a304fdd0971fc46700818a7
MD5 06ef3d3a0aa492f4da1b04a8e24d9588
BLAKE2b-256 6cf91982ce2e40d8e92a2b8be725b02e3ee899f973cad27abcb0c26180ee32b6

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