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

Uploaded CPython 3.8+ macOS 11.0+ ARM64

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

Uploaded CPython 3.6+ Windows x86-64

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

Uploaded CPython 3.6+ Windows x86

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

Uploaded CPython 3.6+

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

Uploaded CPython 3.4+

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

Uploaded CPython 3.4+

hdbcli-2.19.18-cp34-abi3-macosx_10_11_x86_64.whl (5.6 MB view details)

Uploaded CPython 3.4+ macOS 10.11+ x86-64

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

Uploaded CPython 2.7mu

hdbcli-2.19.18-cp27-cp27mu-macosx_10_7_x86_64.whl (5.6 MB view details)

Uploaded CPython 2.7mu macOS 10.7+ x86-64

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

Uploaded CPython 2.7m Windows x86-64

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

Uploaded CPython 2.7m

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

Uploaded CPython 2.7m

hdbcli-2.19.18-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.19.18-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: hdbcli-2.19.18-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.18-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 88d493eeb201f3db1c2514fc24e1b58da163fb7ac54847e579b983db3136f873
MD5 08c79050c54035b948d0256037d9ea7a
BLAKE2b-256 cf7cce1916b36e2495613fb49500b39834c3949ab87ee2268c3616f0646a0b65

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.18-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.18-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 6fb969c176b5f7d6cd7e05a948b0c61831b59a35e0e8e4163b1625d0d7ddff83
MD5 5b7c5bdb410f694aa42f4a0da7226054
BLAKE2b-256 2ea7095e01c84dd816c192fffc1030977348c1e81dbc34bc9dee4d6187ad10e8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.18-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.18-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 dc9eb83f1b6023a13a9ed4bf2972be54e35b4c73d7ff6296527e84d4fcb7975f
MD5 c5bf97bcaa6b40d86b45edc13c1e15ab
BLAKE2b-256 5944ea3e0fadcee0d73a6f3b2711e4f4aa941e489b71e3233a651b58083d59c1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.18-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.18-cp36-abi3-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8d59d4397caf0866513d6b828625f6051d02bc24c8f9c516e940c5e2fbed2ce9
MD5 31a8b18c9d29bc161d6c0cefe4c8bba4
BLAKE2b-256 0f1bd268aac1fdecabf34251195ff9b1ebcd301ee64cb1a8bc6b6fb669cd00b8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.18-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.18-cp34-abi3-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 04cdf5840d57a622d87abc110772fea359966176073ec997124bf246ad0102a5
MD5 6729d1c72da772bcac876b1cef6ad8c4
BLAKE2b-256 62bb66173cafa740be12dd6513de4f6099b94f4c64e878806a64776c51f3e8a5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.18-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.18-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 de7c3e0c3d859160c7879badf305e9589219721ad778e2bbabc079c8ab15f654
MD5 06a626fa330c69f7a8f7c77871bcc808
BLAKE2b-256 0d42e2d84256a521220a4aa31368b2758276327fb8bcc1c38d929cebd8b0fd93

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.18-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.19.18-cp34-abi3-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 e9ecac25db199c3cf064fbbaff98a252f1e26c389215d3f92b2df0318f7573a0
MD5 c5dab19c7d3c482e79e0d52ddb8c91c4
BLAKE2b-256 d90cbfb01e7179da5e70f027d0d48904701a358259cdc236c4570fb4aaa42136

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.18-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.18-cp27-cp27mu-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 fd8b5a82c77cc48a476b29216b3110f48b560eebee43fcba03bf60f9c776503f
MD5 1e164eb1eed9c3a9824b06ce3ac0192e
BLAKE2b-256 0cddfbdfb04221364d46a8f60f7b4be0b20b30e2d3f4bd770826fe6679074472

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.18-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.19.18-cp27-cp27mu-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 ec7e84a6b3b33921d2107762b3002f62c9925f794b7188e5eda9f66222eb63fb
MD5 f767001b64b884b0f95757b3123518b2
BLAKE2b-256 3241a1340608515c450f2832aa0b13e63bd5bf304435135b64dfa719e9bdefe4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.18-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.18-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 4d3ba975bb947cacadc398fe478e77ebbbad44ed3df5415fdb740d64cf3cf2e4
MD5 c9968e54cf89c634bac8c305b1f81a6f
BLAKE2b-256 dbf60b8ad73e55678d6e5b6df9829204fbab02a3055d99f28adc83e67831f0a5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.18-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.18-cp27-cp27m-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 a3ff1a87c7197341163ed648e9e2c232a818f68409e6e91b082977d40f96c85c
MD5 073ddc812a896d7a36dca33184bca56a
BLAKE2b-256 d8fe5b235c8a6089581a8dee5ba7a2a83f8da1aa82febe74c53a3d9c15a2b87f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.18-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.18-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6d8fd2e66a39e29cb771173a13588427cc29ec77343be4ab175df7642557b4ed
MD5 01bcabefd6dfebe27cd32092764996a0
BLAKE2b-256 40b571b4c5cf408c7797b2428b85ad0fada4628404b77da81b1abb242598ce8c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.19.18-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.19.18-cp27-cp27m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 5d1201baf2b38b157971a1208d1d1829449d29c00ca3497001de71b08e49282f
MD5 6483f38a3c39e04667c9403c3568b221
BLAKE2b-256 d1227ac2e43ceef4edeaaf3e7c200823ca784923b6631b320b6e9679d21eb402

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