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

Uploaded CPython 3.8+ macOS 11.0+ ARM64

hdbcli-2.21.31-cp36-abi3-win_amd64.whl (3.6 MB view details)

Uploaded CPython 3.6+ Windows x86-64

hdbcli-2.21.31-cp36-abi3-win32.whl (3.6 MB view details)

Uploaded CPython 3.6+ Windows x86

hdbcli-2.21.31-cp36-abi3-manylinux2014_aarch64.whl (10.9 MB view details)

Uploaded CPython 3.6+

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

Uploaded CPython 3.4+

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

Uploaded CPython 3.4+

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

Uploaded CPython 3.4+ macOS 10.11+ x86-64

hdbcli-2.21.31-cp27-cp27mu-manylinux2014_ppc64le.whl (11.0 MB view details)

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mu macOS 10.7+ x86-64

hdbcli-2.21.31-cp27-cp27m-win_amd64.whl (3.6 MB view details)

Uploaded CPython 2.7m Windows x86-64

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

Uploaded CPython 2.7m

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

Uploaded CPython 2.7m

hdbcli-2.21.31-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.21.31-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hdbcli-2.21.31-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0f7bd50c329db67033e9e744f80ad6afe93be94ba5d266ce9d7a8ff64b15705a
MD5 626c6181e013f0a14ff70760152cd4d2
BLAKE2b-256 0b03ada6fc082a405d49abcb6a57c2e0b24a7d6a753ca63969b86367f03612bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.21.31-cp36-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.6+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for hdbcli-2.21.31-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 95c54ba0d9cb7ff6822f978ab4535dba1fa6f7fea07730285fea424165d83df5
MD5 3e51f78d17f83551d5449c1a7c695a8e
BLAKE2b-256 f24c5e8781059dba23739b73d78317abc9dba5a3795a680e2ee369d455a81cc6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.21.31-cp36-abi3-win32.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.6+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for hdbcli-2.21.31-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 d6c4b6f473c3a055a297b77b62056f06c1588d89de73f0d2e11a81def8fb28cf
MD5 fdfa33f7f8cee988586fb94b2391151b
BLAKE2b-256 cc90d0f51ee7f4616de8bc6ff2cadb9928a9715f3fc8d4e7722b285f718251af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.31-cp36-abi3-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 521bfb321ddc9e09a698fd441611bdc57437781aaa47b61574d1787ac85e26a0
MD5 d7a0a6b64fbf023073fafc282a6982cf
BLAKE2b-256 590a515afe933b568253747ae8703668795b846a824f595c36bf4a64ee9750a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.31-cp34-abi3-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 fdec076c1a72ab5d699a8043785848c2b78d8fe71ea4ed0919829dc1240ece55
MD5 91a1ba56c973ce37183d44efb047ce7a
BLAKE2b-256 abf117f658ccd1483e531efc2de16d97b9439e69a6cab30e8c61c3b84b83f10c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.31-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 dc550e92e636b4983e6fd24f2d0d62737a6107931ac12c95783f81b8b665ccaf
MD5 36684f4bc32b1cd00379299064479633
BLAKE2b-256 546393e0c87dd2cbf6ceea0b21ac6c32ec9afadf38388714d450a5fdd37ea52c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.31-cp34-abi3-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 cffdc47925e6e55104e3ccb2b1d8583fae9d92110eebbca1d22654ec2623b277
MD5 6a55397cd47a3dc8df4e75a7926dcfcc
BLAKE2b-256 d957b1dd096f8a8c5442d035525d9ce779cc4149e4b307129926d0bf25efa8aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.31-cp27-cp27mu-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 592fb55d519aa323bdb50de97300259c2e0b78bfaf8116ab6990373ca3bb72ca
MD5 5358a9aff9d695ffbf49ac5cb6f8fc3e
BLAKE2b-256 8ee94722f2e6113ec0ab3cc0f6cb522bb6ec4de8d892ac4c7720651df5bab2cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.31-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b90e32edb4c1dbe8f1a0f7c59b8162cd5d1617617ca875e981dba99db9f8e57f
MD5 cf70e76b5e4d123f59dd225e2b07ac7d
BLAKE2b-256 9d2806423dc55f32f07460b646b86d9c7d0cf5906d15033d4ee771a147387d54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.31-cp27-cp27mu-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 4ef40e12c67ee0a1e746380f16c56ee92e25b3fd7d9bb4fe1fa11c3e4b1f1d72
MD5 c77d8e2a64a29e378e80a161c710c332
BLAKE2b-256 58f0072e3a9c938bd449740aa50d1bb6ba19a790513ada9728cd784b6620d027

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.21.31-cp27-cp27m-win_amd64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 2.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for hdbcli-2.21.31-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 7d5db77bff340ab3d86aa67631c013fc1a74887a9a57ddf964fc977d3ec786f7
MD5 6e7e9beeb86a95cc6e67b874ca250a34
BLAKE2b-256 4c6218d8ef085d41c6f5c98b071f18ef4111483fc50c7053c6b02fdf1619ed75

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.31-cp27-cp27m-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 55a10ed2388bffeba2140d5f0b51691b74c461b08686d6020b7b8230fbc5283f
MD5 6d27958bd18cc211984c502c531cbf8c
BLAKE2b-256 9da57d7af3e17964d49bb6678c1af0211f28d226e841397a01980956b1141dbe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.31-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f1b62ee2e0af110f8697d24a7fe46e724b6593f80796c55bb467fd57660c06db
MD5 ba8f663395547d8b01114d064e783b70
BLAKE2b-256 68dfa92cf95a30a3598fd2614c91ecf12a82a4f8eae18c9bd395fdaec9e313b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.31-cp27-cp27m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 63ef82363bd36ec7b7ecb41e52ca44ecd684b269bb1f3eb346bff478a50f0f59
MD5 5f352a4de629f31e85afdb802b555fc3
BLAKE2b-256 0735577d19828c279905141f6223b3865f50717cdd2c296137546a74a4955d9a

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