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

Uploaded CPython 3.8+ macOS 11.0+ ARM64

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

Uploaded CPython 3.6+ Windows x86-64

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

Uploaded CPython 3.6+ Windows x86

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

Uploaded CPython 3.6+

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

Uploaded CPython 3.4+

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

Uploaded CPython 3.4+

hdbcli-2.17.21-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.21-cp27-cp27mu-manylinux2014_ppc64le.whl (11.0 MB view details)

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mu

hdbcli-2.17.21-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.21-cp27-cp27m-win_amd64.whl (3.5 MB view details)

Uploaded CPython 2.7m Windows x86-64

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

Uploaded CPython 2.7m

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

Uploaded CPython 2.7m

hdbcli-2.17.21-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.21-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: hdbcli-2.17.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.17.21-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b7ec86a63d415ac448e7ea2d7e2c624c5e689672d3d83b8c1e89495d290c2072
MD5 afefbb6c68ebef05cc9a3ee7acda5308
BLAKE2b-256 88f29124e840a5f31554feb950862c2f59f5d371a9f7ac3cb1a8e6946001ce04

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.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.17.21-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 1987b2cd101269fba9fb391d80ac32fd33ed8fa712f40f322a9c52be2231b3eb
MD5 32a5bb5fd6a799aff6729a3d23973ff0
BLAKE2b-256 a823971871fcc3eacb15ba368073546139d3eb54978a77e06af1fb51e2a85795

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.21-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.21-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 91d3e42779e90552f4907fefd0deed971933e5bcf04629dd72930c678c453b7e
MD5 5f03d622fefa8d73c903d22e3709d4c1
BLAKE2b-256 f72a54ad50ae47164271111b289199b0098356f0c7741caf6e0cc9600aaf85c8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.21-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.21-cp36-abi3-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 559fca6a0fcadbddc111eb373c0e1a696925661725d311ae51da198b78777121
MD5 c48286e9c482931408d9cf84caf5c356
BLAKE2b-256 fdd1269cdb66753c59edd769a0267427a9f100309f58b14d7fb8cf3ee99c5019

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.21-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.21-cp34-abi3-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 66c0873af12e3e9394941863d4f9353496a6371569bf31fbdcaa5a113465e58b
MD5 e4431a369f5f49f539d2814558bcd322
BLAKE2b-256 6bd67f0659f44837f3a525ad5ddd07da6b52283427b539429f3dd6ad4fd3647e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.21-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.21-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 022054772e9383374fa03c21af7a121438738bd1bb38d04f44a04a02328310b3
MD5 7d5e0a9769bc156a3ddc96d827b6de41
BLAKE2b-256 233e52c267c66ae8fa8b4f2042fab0983113f3315d48e5b66a5082fa811ff444

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.21-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.21-cp34-abi3-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 3cf49aa9e58dfda0329f4ed1bf66c743a49f7860d180f349b75f20543a5f0755
MD5 ffa605487a8a11e9d579c83e923df09a
BLAKE2b-256 cade9db27aa8d03123616ec1ba28f028ff7a2e6cb6b3e5c63d3fca97109fefcc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.21-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.21-cp27-cp27mu-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 ea36798bc51d46b8eb2bb1c64975db3a558a95a9b7605a484d120f92c09bb368
MD5 2753e6cff340ff84d4421a4cc6278a4d
BLAKE2b-256 a2274ca5eb676153d5e8c91134ce98c8ec5ea71a20da4b659edc61d7b644f999

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.21-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.21-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 22b5b7ad7d28ba36e5834481ddcdfe7a4090bc0e614f9b568eec377956617d2e
MD5 05631384b8237db3b9309e2ae7910cce
BLAKE2b-256 999126f4922b4ffa79fae6660c469e3c51016c1ccf4faa739997cbaebaef08d1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.21-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.21-cp27-cp27mu-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 4487bcc797fbdcd8da9d1fcf412f0baee0dbecfd52a54cbb32c1814b32d25420
MD5 69a7f8d31f8853c7aab0bab9c85a3898
BLAKE2b-256 2590a46de2a7f3d97692ca3ecb86d8782d3fb855e8cf52144f75eeaaa44e5f69

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.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.17.21-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 1928e4f085e1379e0ee8c1efdbf20d1d6fee290a5e000de5d6f8c0b1d7cf6616
MD5 2bb7dd2cd4cee0e0c64a2d740f835989
BLAKE2b-256 e148d5c7e97179873fe0f3c0335cc253a772426dce37524352511f57ae437572

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.21-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.21-cp27-cp27m-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 52667b3df057d184dc4df9ef0a6cb52c29d567a8a1a5bcbfbc470287c22caea3
MD5 be3b572b1f3d991f6ade2a6743a9b1fd
BLAKE2b-256 8f38f559765c454cc8f5387d69228a8cba5dd5d8200603e151b6b1717c8ef6f8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.21-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.21-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3bfb37558e02e7bc36e836014ecb5cc71710332ad283c8e39d7bd69ba620c3bd
MD5 689ffc758155f1e80893fb48aac25a6e
BLAKE2b-256 51f53ff13d85235f3513adec371a50aedb3c24dc188ae351b6a46b8c2882534f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.21-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.21-cp27-cp27m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 768e5892b87d5dd09d2d3d8cf5f3363c048f480d10d0f37b3c745a4ff1cadc8e
MD5 3b29625432b7d8d56921fe9bb38a4d4e
BLAKE2b-256 cfc26947c78bc2af29df000326d8cb4d5d4a851088d9835f7d21c76dd4d792b7

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