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

Uploaded CPython 3.8+ macOS 11.0+ ARM64

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

Uploaded CPython 3.6+ Windows x86-64

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

Uploaded CPython 3.6+ Windows x86

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

Uploaded CPython 3.6+

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

Uploaded CPython 3.4+

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

Uploaded CPython 3.4+

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

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7m Windows x86-64

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

Uploaded CPython 2.7m

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

Uploaded CPython 2.7m

hdbcli-2.17.14-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.14-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: hdbcli-2.17.14-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.14-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0b48931121f3af8860028ee514c55d88378a62130b49533d4c21ee650c31155d
MD5 9355e346169cca89867dfb24aabecbeb
BLAKE2b-256 88e78b5e94e033bf9bea9d5e5999429ecb5ab5f7be19c7fa90c80bcd01623421

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.14-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.14-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b88685ff27442fc833ded882214cc28cfb947758224ac3385fbaffe591e67d44
MD5 37a3a12e4e82c2cfdef79b91a92cfb11
BLAKE2b-256 b7109d62092c86d60d5d60b8d7b82d489f1f3edc88cdf5985e9b2aa25243e6dd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.14-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.14-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 d2c4b3897c9e5950f44c765338e3b1fd5d99beddcfed165f3cc3368558156f23
MD5 e400379b3883a7694e859b685c267f70
BLAKE2b-256 928cfa9443997f9a7452f3217fe36fa5de3378cc2eb46f9cd2c9c023e7ad3c6a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.14-cp36-abi3-manylinux2014_aarch64.whl
  • Upload date:
  • Size: 10.9 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.14-cp36-abi3-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 401e4ea3162f39621b65cd5fbdb4e2f0629841962593ee143bfa1566885de781
MD5 e69fd6ed62dc97c41debfd3223215a87
BLAKE2b-256 a81cd7d43f9a8bb4111b02f2e4bf6caf4079c72c201a178fe723984bfa1cc881

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.14-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.14-cp34-abi3-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 6b3fbf935b597f6e7d816e041cd91511046b9b1ef216f87b193dda6b3c080569
MD5 9b151dc89ad8a9d14de88f188dfba1ea
BLAKE2b-256 b78f658d9f1d8d399f52fc533f363c956267cd1d29f71f2b68483d1e6cad5136

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.14-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.14-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8bdc064979cf81edfeca2bb01a71c2cd161717938bced1c2dd9aee898112729b
MD5 d671101171efffc144f916f5ef5e8c53
BLAKE2b-256 cb2ae9acc74fb5885eaae7cbf672c0d9ac72f711551429a940f101f62ed34eaf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.14-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.14-cp34-abi3-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 4bacf3813921f8e48ca188aa72742fa84213b0fffd2d56111014e8c6eb637131
MD5 b9f97b0078d23a4fd1c2b9d308830d10
BLAKE2b-256 5010d86c9427966129852191412f0cae83fcecd9df3f53f0abe3b3d495f18305

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.14-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.14-cp27-cp27mu-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 92d2784c5094d98d2f73098ac8d6564aab8c482a5b8d257e588d217496272dce
MD5 982dc82919b8f36e1ada06bb6a0fc5be
BLAKE2b-256 05ee559ea012a17c8e82de4479b1eebff67e968479f02dfc3ce0fc06cf1bca71

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.14-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.14-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 bf402972167853e5dad968bc5cd1f7583340db011c80b3b5fccc8a3eea244a8b
MD5 1a007dd841700f46f16b783e07b7d093
BLAKE2b-256 719890a70768940d942aaff94b52741b594dd28b1fd718d9e88af683ae94c562

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.14-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.14-cp27-cp27mu-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 9f695c8e17e10282b7d1d73812a12f42bdf955bf75b8c4f215105b5184452613
MD5 b51e41cda3490f06775866af25f9c55c
BLAKE2b-256 38637ff9b91a5f7f5f0b779a9748f1b15dc4c5f9aaeb81abcb7b9435a377ec81

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.14-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.14-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 5eeb9ae9fc7cad563b0d40c614f34cf21c09d4109be896d03421720cdca544cc
MD5 5bc2d3f6fef302a89a7559f4f357af60
BLAKE2b-256 3dc14f45ed9891a9ae4eb678e15d7405f54edef63de70e64f686c75217b4410c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.14-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.14-cp27-cp27m-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 a6832b5ad4d7a14cb29392d4e9577d2982a6445372ae176ced4b6a34348d85bf
MD5 62818857ae666e3954f054a00284059a
BLAKE2b-256 9bc41020170ea9d38806e91b544eaf786603371f812eeb899524e2325bb123e9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.14-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.14-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8a19efc624465361a8ed5d53b022e7ba615d73d7c534892092664c63b7903065
MD5 7168ac7dc8057865ef643ceb5562f951
BLAKE2b-256 8ffcf82f49f567799ff026fbf50a61f341cf6caccdcd65be8c6012cfbdccbc28

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.17.14-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.14-cp27-cp27m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 779a3d3d1afc78c0e087adc90a438f261cfe5bbcc4044858297eeb5727286bd8
MD5 69419ce6a97a016a12329ca70a4945a2
BLAKE2b-256 2d4ec7df4b72026b5bad21adefeee5329edbabdff640f7bf7f04ac4593af84d7

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