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

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

hdbcli-2.21.26-cp38-abi3-macosx_11_0_arm64.whl (5.0 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

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

Uploaded CPython 3.6+Windows x86-64

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

Uploaded CPython 3.6+Windows x86

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

Uploaded CPython 3.6+

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

Uploaded CPython 3.4+

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

Uploaded CPython 3.4+

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

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mumacOS 10.7+ x86-64

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

Uploaded CPython 2.7mWindows x86-64

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

Uploaded CPython 2.7m

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

Uploaded CPython 2.7m

hdbcli-2.21.26-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.21.26-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hdbcli-2.21.26-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6351053f6808f90c2815984825be6b54ed8594666fe1db0624806557f3191b29
MD5 9ec00e16db14cfa04f3ffb013f1332c2
BLAKE2b-256 01c489c673fafe8b3aa250cc5505784a347b6a4fffafa27c6db89125c71b2016

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.21.26-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.0 CPython/3.12.1

File hashes

Hashes for hdbcli-2.21.26-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 7a7f60aa14810c2a5b1b9984af86dfaa8c173c9257a69a51e5596198ef1d7ffa
MD5 8182df892b15340687b2ade369bc8c25
BLAKE2b-256 0df2f540716fa4a25d7fb91f15836678ac06601404ee9c5e3f51ab7a9d400b1d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.21.26-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.0 CPython/3.12.1

File hashes

Hashes for hdbcli-2.21.26-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 4f80e2f53ffa82b49f792a34c8fc438af66a3683ef4b48f337d9d13723907df7
MD5 1a5d319543f8cdf2ba2ad48bcff66aea
BLAKE2b-256 5af468c40b2cce762ea164945b2683b857cf40285a31a44cf385deadd0ab0750

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.26-cp36-abi3-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d0ac2b1a56a1e3d11b7744a6497970f5ea0650e9c0ec75978f8bdd9bba9cca4b
MD5 10e60da04b1379adbc33d6ba370fc365
BLAKE2b-256 7462e7104d934a1d08184e482f4de35566d6295abb2ea01abe70d6ab526426d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.26-cp34-abi3-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 ebadcc0d1500262c8883f17bd8423fd530adb9c1e9f42ff8741f3fa783edef1f
MD5 75ce49cdc9c773e684f12f60d82aa694
BLAKE2b-256 82e4b49bf2f47dae683f496070bc7a502e14007ae01c78f0fd2debe51ced0d4e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.26-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 73fc2036595618c615b5a0c4e440782985402d164cbde480e51f07f5dbcdd4ae
MD5 91d6ea89205b666bd99516a32e0c6b06
BLAKE2b-256 2862ef0dde42dc8a9954e8424c301dc217997ad1e3a74b9410ac3aace3d5e28e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.26-cp34-abi3-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 694a04a378c14af55deed373debff2a99192505825f29a238ccf3c6233be3139
MD5 daab4a6b3d5659e8509715f583c20c65
BLAKE2b-256 d1a8ec8427f88a563303e45a57f98d531decdea4973eaaed03ffa1e4da435e13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.26-cp27-cp27mu-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 3f11adfceccc16ae6134dc6ab153bce7ba92b672d71179fffa76cabd29847ba3
MD5 99ec022a6cde804c67c580e5fcc4b7cf
BLAKE2b-256 8aadfad8caa83af41862db32744bd3acfd807ac1563b1898f5212867dadf8fb4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.26-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f2e5a2d09ff1310500097584e4a1399658b2169366d7bd1a46fe34caad5ce58e
MD5 be28dcce51cd9b8194ae4d7d4bf23bdc
BLAKE2b-256 f2eeed5aed98186e7ef319f8b45ebe1aa2c0d3dbba241b47de239e24ab8b28f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.26-cp27-cp27mu-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 2a2012e9cb6fc4b8b3caab2488b7d51927fe9adff11526aaef012c15165dcd60
MD5 ba8a411a2074e92b606075118e33d8c3
BLAKE2b-256 c74d067a576c5f63e27a1026d14abcbe2717a4567d604cb0e5d697ae00dcd56b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.21.26-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.0 CPython/3.12.1

File hashes

Hashes for hdbcli-2.21.26-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 f3e8fda6a02f46ce884b539d82e27057f16d27bd4d5de61bb9c1ddbb217e3cee
MD5 6995ffebdb5cab05462cc018d4e1f734
BLAKE2b-256 d613675216c13e4b9a07989f7aa8d63afe6d45f8985b172cdaf70684fbd5d6f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.26-cp27-cp27m-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 b9a753e3acfebf93e576b31424e145fedab47affbb1b7dc56c79a449e7c1e131
MD5 d249d6a373aeaef4be43d9bc52b8a68a
BLAKE2b-256 21d40c91b06e8afd0881f79f70566bb10e97cec42cb3b361f1d2064be32e4e7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.26-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c8efdb4f29c339eabbc8c84a0a2251fa2a529b695ad0969d09b30ec4910e4b67
MD5 801cf36b3caf8d3dfac084e0c1b75672
BLAKE2b-256 458b55418d1a95de1e9ffbd3283ce85c018cb159395dc7b57c602d9c8390c760

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.26-cp27-cp27m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 31a8463d846eb064ccaccdd256d26038fef5c03604e797a108df2f87e5f8777a
MD5 ea78ae1a8cb3b65f0e257b6dccb18988
BLAKE2b-256 455d819f6d3bcaf879f7dbaf8f0559e0252fcaeafcb3133d23ce7dd2eafc3ae6

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