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

Uploaded CPython 3.8+macOS 11.0+ ARM64

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

Uploaded CPython 3.6+Windows x86-64

hdbcli-2.20.15-cp36-abi3-win32.whl (3.5 MB view details)

Uploaded CPython 3.6+Windows x86

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

Uploaded CPython 3.6+

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

Uploaded CPython 3.4+

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

Uploaded CPython 3.4+

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

Uploaded CPython 3.4+macOS 10.11+ x86-64

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

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mumacOS 10.7+ x86-64

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

Uploaded CPython 2.7mWindows x86-64

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

Uploaded CPython 2.7m

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

Uploaded CPython 2.7m

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

Uploaded CPython 2.7mmacOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: hdbcli-2.20.15-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.20.15-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7dd3c920c8c5bb72669cca3cc6c6d1b18df5d5ee8edc9eb95a1567f0856f998c
MD5 63ecd77d92ce7eaa163eea1cbcdd6c93
BLAKE2b-256 504a17e2230b6fe461ecc82031bf3d5989cf044a80b144152755c72c7143dd14

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.20.15-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.20.15-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 69f02dae4dd079c6dd01e299acf6bda0a8a095a18ea72f6955d84fb99c9fcd4e
MD5 1f3421900ef5df48528315165d1907be
BLAKE2b-256 f13d2d9bb61073c8e22776f06d5393ceddb5013ddb486b7806d30f7be0b74509

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.20.15-cp36-abi3-win32.whl
  • Upload date:
  • Size: 3.5 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.20.15-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 756f0821be0baea981a0f6e74a68c345ce3eba53546cd2371b182b1d84c2f968
MD5 8a14498f705df0bbf665d729b873a559
BLAKE2b-256 caae07a2314ff9f4ab3f3056d0191aaa55f33598b06c81860807483837f5ddf4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.20.15-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.20.15-cp36-abi3-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3177e62266366e12e5f7d5866b05bc97c497fbce16574fe5983cb9fd480a4de1
MD5 05ce4b2a8a2fb1f91f82d1887b3b2d35
BLAKE2b-256 30d204784eeb51698e81563b5f13e11b55413abd624ef8064aa5ea52e8a3fab0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.20.15-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.20.15-cp34-abi3-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 3cc94e2372954aa1a3cb5db6b946fddcc6e1251bcda2696279750c7f068e4f24
MD5 8d5554db177676efe8f212aa53dd1099
BLAKE2b-256 b44d269fa18817722de7e97714c64026597e07b4b01668b3f52f270c6fb477ff

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.20.15-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.20.15-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b62c5a85351b3bf62c6f65c468bca495df8a9ada1f1822ef54fc382e0270b6ca
MD5 787b5737ac16f28cf33f30c2f6825143
BLAKE2b-256 c17d562bab07223216027dc6dd2ae41e801fe1be56173d9ac3cce1f667a4a8d4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.20.15-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.20.15-cp34-abi3-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 60fe7be485a6dde0bb68998aacc0961265efe4c0e1d8e10f7ea68c0522429102
MD5 b65a169d797bf4289e91e89a00fad82c
BLAKE2b-256 21ce52e9aeb86bde4afad96663200e07a5047e15c413c1379efb3fa051e4cb35

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.20.15-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.20.15-cp27-cp27mu-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 24147e184271e5fefa117686fab3e8491a9e93bfd055ba5fac0dcaa0c93adad8
MD5 336b76cc607ab9dccf2d4642d680deb7
BLAKE2b-256 526d6fdd9dc5f9b3786da15e487e9648bc54da24ac77d19676e78cfe2e343373

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.20.15-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.20.15-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 cfdeccdfa2ee275993e975dcb5919825b6467f3a72caaa9a6903ff374dd9ee9d
MD5 fd050dcc8d0101a611d201eab4e45314
BLAKE2b-256 77685214dafd08129102f92038a3dc520e95aaf6f4f163b9df65073ef56d7c39

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.20.15-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.20.15-cp27-cp27mu-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 74a40be3c95c1b5dc893043af4e8c6c7b42dcd87b40f763415cc2bf54676f0aa
MD5 f03413057f194e83ea2f46125e3c0c76
BLAKE2b-256 ab30db0cdbdaebf6a6ad85b49515ea15ca623a3eaff98fc88b3a84b42dcc839f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.20.15-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.20.15-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 0e2209157b5cc154519d8e819eaf7f7746b57559600a623a328892b419d467a9
MD5 1a17b3024e32f48e1307524d67b16fa6
BLAKE2b-256 f187b516cf1bb2355ce2c5e6874cfd54e8e63031358de78f8efc2cb24ce2e67a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.20.15-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.20.15-cp27-cp27m-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 b81db601c2e8245daa9b101dcdf2f32d333b2cb7013462d740f83518c7978fde
MD5 c34f903076f16d8bd955b3c498d42e70
BLAKE2b-256 4eb8947649591de4c896ab56c2d8d6300e367bf8dddd3ce6027be28c374eee63

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.20.15-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.20.15-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4878ba4395d1e4942d9a04bbe5f3e6b7c797057b3ae628b2a96e22b58a95ad28
MD5 fa54a3fd743b817ef7cb77a066171d1f
BLAKE2b-256 fb8123adc873d26b315ecd32ade17f526fca8d4e782c912e7788d2c7ac39aaa1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.20.15-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.20.15-cp27-cp27m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 16642512ddd15505f528cd7597a701f109b9ea0144e4afd08ba247aba50d0e9c
MD5 2c3b3672d7bf15bab0e39c9270f7aa96
BLAKE2b-256 35f9de84e4cac2cec096448ced25a95de7477f167953bdb2321ec42ba26f89a0

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