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

Uploaded CPython 3.8+ macOS 11.0+ ARM64

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

Uploaded CPython 3.6+ Windows x86-64

hdbcli-2.19.20-cp36-abi3-win32.whl (3.2 MB view details)

Uploaded CPython 3.6+ Windows x86

hdbcli-2.19.20-cp36-abi3-manylinux2014_aarch64.whl (10.7 MB view details)

Uploaded CPython 3.6+

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

Uploaded CPython 3.4+

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

Uploaded CPython 3.4+

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

Uploaded CPython 3.4+ macOS 10.11+ x86-64

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

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mu macOS 10.7+ x86-64

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

Uploaded CPython 2.7m Windows x86-64

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

Uploaded CPython 2.7m

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

Uploaded CPython 2.7m

hdbcli-2.19.20-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.19.20-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: hdbcli-2.19.20-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.19.20-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 59ed0fb1482eb626e4874654a206369fc2bf253d4198abd3d6542d24f336d182
MD5 01bb75b2bf4a1c609ccd26d0b2be46aa
BLAKE2b-256 1aed6ceef514efbef101c05ea4502b7402daeffe999300eb139ee044310f6e1a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.20-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.19.20-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 3e7d9eb18bd3d41b82e24622d1ca6ee01b807a668bbfd44cb59da6869695a4c5
MD5 0b3dab017ab0cd90eeb2043f3ee4ec75
BLAKE2b-256 151a5a8f42fc6d2ed5ae7adfaa9b4c6d799a1e05ef7f03f6ab24a78263011b4d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.20-cp36-abi3-win32.whl
  • Upload date:
  • Size: 3.2 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.19.20-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 f59c021fdf6f8ebec3400ce0ee5c1f20e26ede73624dd3345bbf19ffbecc1d24
MD5 6804983cc3cd7f1cacfe70fe803f4518
BLAKE2b-256 f6f74fa75b02eb32599b6d155e6e1ec6b5ef8ea92f84ff17b2c127ea29c8526b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.20-cp36-abi3-manylinux2014_aarch64.whl
  • Upload date:
  • Size: 10.7 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.19.20-cp36-abi3-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 437862f3b485b33421ae24a4d961df36e13b015ba99d7d2332210d98e76dc52a
MD5 76f857fc9df7897243882308f6be4480
BLAKE2b-256 6d6f0b956a9a54a378101c0a6b5e69e2057184f58ee39166e67e48d4b7848887

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.20-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.19.20-cp34-abi3-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 aedb4fba1c5b1539cecbccad51e905321cc83c6f4b3fe2cf6ea84421cd0b7e22
MD5 25bebba3121e685b537ef63c5db6353f
BLAKE2b-256 944ea4c3878b62b140d2d7b2b0325561d0c23ef4cd7c7a92a7e342b2529a70b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.20-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.19.20-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 fd77abbd4a24d8b3bb359996b15b840fc77b7620a3cb0cb39b2a4dba1ee2a178
MD5 7d48b7f3b8d888630341c417f6f3dd50
BLAKE2b-256 61186d94e1b1318a94d6dbb3fd15e15d88c6b93c022725bdb53d6bffa6a68479

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.20-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.19.20-cp34-abi3-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 b33599a72a65d3b4d11e383bd35680a27b4c0b63734a456b561d26b7ec78b32a
MD5 87d9d219a1f102012c7e01dfe153275d
BLAKE2b-256 11c5a30e31cc4f7ede3584ab83698b5b45a7f93ec30c0e85770b69e4e6410cdc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.20-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.19.20-cp27-cp27mu-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 4b5c0fae282c981db485419a766f877cc0440456ad96aad23a949ea200ca1fd0
MD5 db20b1ef7561a40047147a8cab5ba4a9
BLAKE2b-256 ea1059d31152c8215baeeff37d21abc5ff403a4845c1aa27845b14ebb3f0cf92

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.20-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.19.20-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e55f5d9cc162c21ff18c15e5ebfff8b15a7701ef35d12d99c8d8a95a575de0d0
MD5 87961a15f5b7b4d4d23ae5d8a9c8a5b3
BLAKE2b-256 9efd94ead0e3cf5c41d2582bfa80cd134c5d118fd30c377ed1e8e660a39a6e6c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.20-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.19.20-cp27-cp27mu-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 44bd092133fc2144ea01daa2a974f6bab1e9f1a6aa36de099c4b1a4b94f7a1df
MD5 4dab411b58c2c493f20cf2bee95c1240
BLAKE2b-256 d364453d685df03a23c92a9173e1af0480c8f65522ed48399f2d462102fa7d8c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.20-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.19.20-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 cdda6ea1cfe95b3aac49b60b4ace166b9e9f3e3709cda515618ab38e2c2fbf6c
MD5 1b2e6f2f37b038217442c9e180bb37f0
BLAKE2b-256 279ac9e8f676fd7c86c9f2e0cdbcc84fa457f9d04749f30d811fced265e925f8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.20-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.19.20-cp27-cp27m-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 90b67b8b402c659fc7952ddf232179b5e38b84471c656f4c086708ce9b07168e
MD5 c2476c04dcff6c14306fb3e2eb695515
BLAKE2b-256 e527cdccf7c7415e22350f786aa702f3923f60fcd5f5cc7437559c3494994942

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.20-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.19.20-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4f6949012c98509591ba7f4efcfafd9f8a87512b78ed081ac68d16dda724e81c
MD5 143e19d6bb0899dce21960be3f893488
BLAKE2b-256 03eac053e0ee2f16691e365c579ad066187ba2cccca84e03988946c0b617d1ba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.20-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.19.20-cp27-cp27m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 c3310945e99df3e1aaca4a3da908b575a04dca8e7a03fdf382aba1e1811c08e7
MD5 0596716ba235b5d278bd2701ee9b9200
BLAKE2b-256 4d84b966abb12df41db466989b8f6417eea878adcf09d3cc830218e73a5095ee

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