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.182-cp38-cp38m-win_amd64.whl (3.3 MB view details)

Uploaded CPython 3.8mWindows x86-64

hdbcli-2.4.182-cp37-cp37m-win_amd64.whl (3.3 MB view details)

Uploaded CPython 3.7mWindows x86-64

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

Uploaded CPython 3.6mWindows x86-64

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

Uploaded CPython 3.5mWindows x86-64

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

Uploaded CPython 3.4mWindows x86-64

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

Uploaded CPython 3.4+

hdbcli-2.4.182-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.182-cp27-cp27mu-manylinux1_x86_64.whl (22.4 MB view details)

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mumacOS 10.6+ x86-64

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

Uploaded CPython 2.7mWindows x86-64

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

Uploaded CPython 2.7m

hdbcli-2.4.182-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.182-cp38-cp38m-win_amd64.whl.

File metadata

  • Download URL: hdbcli-2.4.182-cp38-cp38m-win_amd64.whl
  • Upload date:
  • Size: 3.3 MB
  • Tags: CPython 3.8m, 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.42.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.182-cp38-cp38m-win_amd64.whl
Algorithm Hash digest
SHA256 b34378ca9cccd813b4d45cc0021d1a485ac012cdec32e6365e6940277a7427b3
MD5 e30d354f6f33e20e4b62727e444a8864
BLAKE2b-256 4d7f4efdb1d47d9833302e843100babf5ec93371f0032fe662320f4b345e017b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.182-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.42.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.182-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 ef41ee0a7173fdeafae20e7b92e3dc4e1b466d815149e71e08a8229ce6781e99
MD5 49e449e32fa8bc4a596c4bae79570be3
BLAKE2b-256 e76b03602b8193b9c7ce70790775c335a9fe9bb9b378a01e8db023249e364565

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.182-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.42.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.182-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 a550abc043abab2b21a835cf85c30317b6bc2b92cd7687df9046dff94cb83e7b
MD5 65ecf7f62e628d3a7c37d3891b713560
BLAKE2b-256 ba9095e559ea5241ff4b57cf89397532f0f077b95ba1ade07cabc9c8d6b69abf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.182-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.42.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.182-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 e71e0f6c8c0e29b95fd6a5284c7c193afd427006115d77198b24cb6c65c5fc78
MD5 2c992c5b49cebd94e6bd130ab7735a67
BLAKE2b-256 805272a3444518469d596cb7103abbbc68846cea6ed5623fb6960ff5bd1ec4db

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.182-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.42.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.182-cp34-cp34m-win_amd64.whl
Algorithm Hash digest
SHA256 38bbdd6153e5bd269cf5b4c9f50a93922e152846c2a509852a76c81cc0c17a20
MD5 37140652722b94690f2a0966cf9805ef
BLAKE2b-256 e3c69b5633103fafa04a6269b92f861e71ed16c74598d15c4cc9db11b5982231

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.182-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.42.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.182-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5fa3bb79c8417638ed1ab153f90823e4ca3783db05ba6415a34ca7d2ac903061
MD5 a6501ec558dac25e5c0d5bf4a2000a4a
BLAKE2b-256 e523108e3426aaab148f4977d321293e7d2df465fda0c4a23ba876419df70730

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.182-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.42.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.182-cp34-abi3-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 cb3c75cad7979b9428e33ac15381e61e8c7f78b88c31ea3898dd9b1c8d6336a4
MD5 ecfb87e11d04dcae1748b4fbd716bff5
BLAKE2b-256 b765aed041a4e909f9e359054714d90743c0336901ce202e2b13187fd7107668

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.182-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.42.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.182-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 237b1140dd6be1fe6f56f761a44b61839234645285ae10bb07fbedaadf9aa98e
MD5 884e2f0ba531c907ca27cf68803e2481
BLAKE2b-256 0df50ffd0d5d6a8049447537117ef08859a4de136a19256c0bc586f3a4a0a548

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.182-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.42.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.182-cp27-cp27mu-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 a1622ddd22f760f15c5b16c7c167173b330216c8c85d2c5f1616a1e95c0015c3
MD5 e004f351c835ccdc756ff4ca47c1827e
BLAKE2b-256 1e2ef6c37bd87ff3ffc8d52202a3db3a8194f4eeb7850405724ef3f73c7204a3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.182-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.42.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.182-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 996b8cdcd3101215b259376e1eb6105d208d0b6db5e3479fcdfc5ff93a859223
MD5 f022ae0030f3a3a1a5d341f4a250b44f
BLAKE2b-256 c472e662e0b16aa2ac705d900923f609c1f69db5db204600b44bf2a6b574fedf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.182-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.42.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.182-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 35136c9c2610f8a4d4d8b9199ab21cb6d8036539df7b96671f3a70a0bac1358c
MD5 b0dd2b42e64f0a7c104dd8e7030f4fd9
BLAKE2b-256 a2b5b2f5e87c21f9964849d380ffab3ff61fa6ad7225452f3c137077e588468c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.182-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.42.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.182-cp27-cp27m-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 cd5951f4a9a1a7d55055e5caa9eb58c3f997258123aa186d44f886a735a4e0af
MD5 ca582c9f612d16f1351502a462a69f6b
BLAKE2b-256 8399bf8aa27adf7c534fd4ce5bc70ce4142601d84857cf1711201f8fa530f39d

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