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

Uploaded CPython 3.8+macOS 11.0+ ARM64

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

Uploaded CPython 3.6+Windows x86-64

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

Uploaded CPython 3.6+Windows x86

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

Uploaded CPython 3.6+

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

Uploaded CPython 3.4+

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

Uploaded CPython 3.4+

hdbcli-2.20.23-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.23-cp27-cp27mu-manylinux2014_ppc64le.whl (10.9 MB view details)

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mumacOS 10.7+ x86-64

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

Uploaded CPython 2.7mWindows x86-64

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

Uploaded CPython 2.7m

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

Uploaded CPython 2.7m

hdbcli-2.20.23-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.23-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hdbcli-2.20.23-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 70f9dd27ea97102e908bf1deb31c9e262f2c1ea39d01f0d0c21fa3d3a46fc5ef
MD5 030adfbf2fe57c29f041fd033376f895
BLAKE2b-256 1f2b5ac2047135ddf8628fc5b54e9658a987c6e226b5c3d7d68eea9941bca377

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.20.23-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/5.1.0 CPython/3.12.1

File hashes

Hashes for hdbcli-2.20.23-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 cba3d5aeb5f1cf6437035dabc77722422d943c1be7508e89d29e9260f08c048e
MD5 fd941ec779a8d8aee7b1e3e348ee04fa
BLAKE2b-256 e99e5640a259558858c5361f7821ae0ab80de8747dfe31db18bd41c27b98260d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.20.23-cp36-abi3-win32.whl
  • Upload date:
  • Size: 3.5 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.20.23-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 0063b8f872b9bc7f3a47bab962e02a9cfc2671eaa02338b968159c3821e3049e
MD5 1bda5b2bda525fde6355f6ee89c508e8
BLAKE2b-256 2025fe040e156adbb9ff0fd1b58bf77b0dc4ed615e4cae56f063187baeafc8a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.20.23-cp36-abi3-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 82e25243e5589dd860b81e47265bd549a9c0426d310370cfa48e712e70d0de49
MD5 f846151fe33c6baf557af8f21d64672b
BLAKE2b-256 2453dca6849638df72d4d05ad2c29736cb4d2ad778214d83b8f89965fd2286bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.20.23-cp34-abi3-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 c6865e383de0699ac4c68715e46963693a8ffc030550cc09a7964512ca3b1abb
MD5 fe2c7d3508947e899b298ccb66f84e9a
BLAKE2b-256 173a70f732ee3161baaf1050ea5c8e0a8fd7a1a0129f8520e70f0e3d6a615064

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.20.23-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0fa7584bd3aa441f094d79e36e3b7c3b482d3b46b995dde23e55a677ca2a18ba
MD5 90ef59eb7dee6716967f098cfb1b437f
BLAKE2b-256 7dcc582e799550cc257bf005dce65347bcafe4a77b5988aef0ad3204cd317e23

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.20.23-cp34-abi3-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 18be9493eefc19dcf6a06ea3494b5c1052d3e17e17efd7e34f185ac5d37c0f1e
MD5 11f6de5450eaba5bf97a68ea875c8a7b
BLAKE2b-256 c0083d86aaff3082b07fbeb9b97e7ab168bf077cbff68e8d67742da634755e98

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.20.23-cp27-cp27mu-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 0d8d32978fcd42c69aa2f93f6044dd2434fed1a84ebfed75c57eb1da4948f216
MD5 4be91eab0487a92c0e962ba344753524
BLAKE2b-256 0b70e172fc0d954679fb53c5138788d4063897991a9584a61bec6adeb1c12fbb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.20.23-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 87a6ca1a6860f39009cabcb972bc4215443943a5cb29e79ae8be1e635f28f0e6
MD5 a1ffa7d1de875c6b35fb0115af85ff3f
BLAKE2b-256 72165075f37da177bc88c66ab727820217b3533d289b03f3423b433a0cbe86a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.20.23-cp27-cp27mu-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 9172763c21348c8d98ce26e1bf60b5783f44f766c0e4eeb9c836f8ea5daea9c9
MD5 df1d4dffc8d6addec1a5ad45581880c9
BLAKE2b-256 905af2885ee49a44b681bf7cf03020afc416d3b4e4ba9a418e3d8a57be4c7025

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.20.23-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/5.1.0 CPython/3.12.1

File hashes

Hashes for hdbcli-2.20.23-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 cd96482cde58ac01dcd0128b809e6d5aeaf56f45b63bffd6ad882cc8c23583da
MD5 5fcc595d86fef999b37b837f4c04120a
BLAKE2b-256 770ea6e0a81393f1e36d53a9943d0c1a4731743064035306262f1192b72b661e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.20.23-cp27-cp27m-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 695054650868ed00dc025c14c54fd30623bfa606aac262e8f09fc57a89f69a98
MD5 89197398e0ca2e5b0be7abea4f53f600
BLAKE2b-256 9be250c0b2c4a8509e403cb83744e22b1002fdecc8b295f85824e0f09807e719

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.20.23-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 99fedceaf66387c4ee7c554ac3949ee2e344ada1132d61d5d811870ec1d4ea4b
MD5 1f247787d35742a302c260e7ad426a02
BLAKE2b-256 11d5e3f5cf136a089bbfa3b54e19fe818decb704bf3da47daa35860578a56f90

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.20.23-cp27-cp27m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 d4f2015733d5fa2dd7128dffd6154af238a45b34ee36d5385a5852741db572e2
MD5 00a579f7b5bc60243e51793ba88742ca
BLAKE2b-256 83ad5e4dc887ce60cbe27afdb55bf5a73a4410433feaa8d6454c9e2304ee5a4b

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