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.

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.4.167-cp37-cp37m-win_amd64.whl (3.3 MB view details)

Uploaded CPython 3.7mWindows x86-64

hdbcli-2.4.167-cp36-cp36m-win_amd64.whl (3.3 MB view details)

Uploaded CPython 3.6mWindows x86-64

hdbcli-2.4.167-cp35-cp35m-win_amd64.whl (3.3 MB view details)

Uploaded CPython 3.5mWindows x86-64

hdbcli-2.4.167-cp34-cp34m-win_amd64.whl (3.3 MB view details)

Uploaded CPython 3.4mWindows x86-64

hdbcli-2.4.167-cp34-abi3-manylinux1_x86_64.whl (22.4 MB view details)

Uploaded CPython 3.4+

hdbcli-2.4.167-cp34-abi3-macosx_10_6_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.4+macOS 10.6+ x86-64

hdbcli-2.4.167-cp27-cp27mu-manylinux1_x86_64.whl (22.4 MB view details)

Uploaded CPython 2.7mu

hdbcli-2.4.167-cp27-cp27mu-macosx_10_6_x86_64.whl (5.3 MB view details)

Uploaded CPython 2.7mumacOS 10.6+ x86-64

hdbcli-2.4.167-cp27-cp27m-win_amd64.whl (3.3 MB view details)

Uploaded CPython 2.7mWindows x86-64

hdbcli-2.4.167-cp27-cp27m-manylinux1_x86_64.whl (22.4 MB view details)

Uploaded CPython 2.7m

hdbcli-2.4.167-cp27-cp27m-macosx_10_6_x86_64.whl (5.3 MB view details)

Uploaded CPython 2.7mmacOS 10.6+ x86-64

File details

Details for the file hdbcli-2.4.167-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: hdbcli-2.4.167-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 3.3 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.167-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 7b2487923a7da43494eb1b47bd1a807c3eecdb30e9f25370efabe7bd085331b3
MD5 5dd2143db6cacbc36b6a8f8223738e3e
BLAKE2b-256 96483d6d4aed19e001938058be213c64c5e7607ac909395136b89179ec87d7ab

See more details on using hashes here.

File details

Details for the file hdbcli-2.4.167-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: hdbcli-2.4.167-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 3.3 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.167-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 97b4d7910deabfa81266e2e85217df49cd4cc2a1d437c372bf96202397724e16
MD5 50b7125d0d1e920a3f2688aacaf4618f
BLAKE2b-256 fb629c71d7c0be7eff7b55e500acd45ccecc57785c585f5119066fb637130e05

See more details on using hashes here.

File details

Details for the file hdbcli-2.4.167-cp35-cp35m-win_amd64.whl.

File metadata

  • Download URL: hdbcli-2.4.167-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 3.3 MB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.167-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 77f7f3d6498074523572e7a2787713b611778e9ded72ff29b3bba0fc986fbe4e
MD5 0ac78505a136396ae8aad4a0ec0b772f
BLAKE2b-256 3b52bea78df4d2c262bcd0b0f675ca89bee8f9f48b07c66921a07e3a5561fdcb

See more details on using hashes here.

File details

Details for the file hdbcli-2.4.167-cp34-cp34m-win_amd64.whl.

File metadata

  • Download URL: hdbcli-2.4.167-cp34-cp34m-win_amd64.whl
  • Upload date:
  • Size: 3.3 MB
  • Tags: CPython 3.4m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.167-cp34-cp34m-win_amd64.whl
Algorithm Hash digest
SHA256 cbad84c8821503f1ebe1c7dc246883e4d0639b6ec55bcc501b3d447222711b28
MD5 a2f2bae00f156a1bf94f7c617b044d40
BLAKE2b-256 a72901dac109c00d5e2e7778bf2b24e3479ffb646c27be94c6c58e31a7a1966d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.167-cp34-abi3-manylinux1_x86_64.whl
  • Upload date:
  • Size: 22.4 MB
  • Tags: CPython 3.4+
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.167-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c71f39184b65e0c817eb076732c9456caaf3b9b80f52d110626eb30c99206273
MD5 a16083c3aa5f6d8a1d5a647fe71a1c3a
BLAKE2b-256 45fce53cf156aec79e6d27f2ec0d487acac46fc7866d713c321f1ba5d23549bb

See more details on using hashes here.

File details

Details for the file hdbcli-2.4.167-cp34-abi3-macosx_10_6_x86_64.whl.

File metadata

  • Download URL: hdbcli-2.4.167-cp34-abi3-macosx_10_6_x86_64.whl
  • Upload date:
  • Size: 5.3 MB
  • Tags: CPython 3.4+, macOS 10.6+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.167-cp34-abi3-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 3f54c57bdfc9671d7295bca2194110904a2cbacacd1c1b7df8e492f175bf69e9
MD5 ba81a0802bb0805de2f7a888f6782a79
BLAKE2b-256 7b750dab56b27e0f7eda9836fe0b6a182a3777106d6a2f0623ac471a48fce18c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.167-cp27-cp27mu-manylinux1_x86_64.whl
  • Upload date:
  • Size: 22.4 MB
  • Tags: CPython 2.7mu
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.167-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 baddf85d82729cbf50e887f580a8d76f25eb9e269d3534798e807d3ccfac4911
MD5 8a04441002643c5682979a4198f38368
BLAKE2b-256 454cfe3d578630798b0ce02dc87948509be6da4b768d17c39de6a553d54b8b39

See more details on using hashes here.

File details

Details for the file hdbcli-2.4.167-cp27-cp27mu-macosx_10_6_x86_64.whl.

File metadata

  • Download URL: hdbcli-2.4.167-cp27-cp27mu-macosx_10_6_x86_64.whl
  • Upload date:
  • Size: 5.3 MB
  • Tags: CPython 2.7mu, macOS 10.6+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.167-cp27-cp27mu-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 9d0e5b76159ff727df16422e2cf641faf7011932bb67201e22d7ae8a7fe2503d
MD5 d97b26ffd97823f5701cad1f578b9b04
BLAKE2b-256 4e14aad0ed3acda4fc1f83e6a762b210b1c4c9d6dd5abf6c05e23114616a1ee3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.167-cp27-cp27m-win_amd64.whl
  • Upload date:
  • Size: 3.3 MB
  • Tags: CPython 2.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.167-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 7646fe173ae3f398e83cbd26a8e5c4b5b7a7cf75e0e355995710aec60c0a67c1
MD5 34036f4edb3aca46172c5ad8867e3ea9
BLAKE2b-256 651a2f16786c8fb31696786a881c505181973a98eb3c682a0ec02f1dd081b2a6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.167-cp27-cp27m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 22.4 MB
  • Tags: CPython 2.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.167-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3dd2045455312267f589736adce1918d746a4d7065dd05b1de5d880d78578df5
MD5 fd79b8dedc0f67188b462cfa7ef5f51b
BLAKE2b-256 fd0ec624986d0ac9bc25aacc6adca67a9a49d555125f64c8376e522c90ad32d5

See more details on using hashes here.

File details

Details for the file hdbcli-2.4.167-cp27-cp27m-macosx_10_6_x86_64.whl.

File metadata

  • Download URL: hdbcli-2.4.167-cp27-cp27m-macosx_10_6_x86_64.whl
  • Upload date:
  • Size: 5.3 MB
  • Tags: CPython 2.7m, macOS 10.6+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.167-cp27-cp27m-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 9510dc00314b759d68754802ef0610d10880f3f88c7f8385e32e951e7d091393
MD5 265edb6709671f01baa6406828b3e08c
BLAKE2b-256 d63514620ef6f25ed1dec888b15ddb31847d6b816dba5fc67a6fc32a4f50d8be

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