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

Uploaded CPython 3.7mWindows x86-64

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

Uploaded CPython 3.6mWindows x86-64

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

Uploaded CPython 3.5mWindows x86-64

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

Uploaded CPython 3.4mWindows x86-64

hdbcli-2.4.142-cp34-abi3-manylinux1_x86_64.whl (21.9 MB view details)

Uploaded CPython 3.4+

hdbcli-2.4.142-cp34-abi3-macosx_10_6_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.4+macOS 10.6+ x86-64

hdbcli-2.4.142-cp27-cp27mu-manylinux1_x86_64.whl (21.9 MB view details)

Uploaded CPython 2.7mu

hdbcli-2.4.142-cp27-cp27mu-macosx_10_6_x86_64.whl (5.2 MB view details)

Uploaded CPython 2.7mumacOS 10.6+ x86-64

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

Uploaded CPython 2.7mWindows x86-64

hdbcli-2.4.142-cp27-cp27m-manylinux1_x86_64.whl (21.9 MB view details)

Uploaded CPython 2.7m

hdbcli-2.4.142-cp27-cp27m-macosx_10_6_x86_64.whl (5.2 MB view details)

Uploaded CPython 2.7mmacOS 10.6+ x86-64

File details

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

File metadata

  • Download URL: hdbcli-2.4.142-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.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.142-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 162a9b226078babbbddd2c50ef95873f5e2cb168561125903ac63cc00a2a008d
MD5 0fbf33bd8c18a26f7445480616b7b3c4
BLAKE2b-256 41636471c62de291772971b2fdb2b9447e3b98937c658273bd48ec85489f1f4c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.142-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.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.142-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 d6950b7f6cb38b5148a8dd0312b989ac7d708d756d8143ede56e95b391b2b197
MD5 19dbc28deaf16e56835758cc0eb5862c
BLAKE2b-256 125ec1ee3ac969ad351dba0667c591efc2a43b061d40673395617a82f1499a8c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.142-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.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.142-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 f3026af1069877d7179c618fef320d187b3354f1398fef154027f3e586508eb9
MD5 086fee44d06a0c77e6324ae92d402e20
BLAKE2b-256 c77a4d6218442174980e5b1235ad3cf7ef33a98d3e8889899c1fc74d99e3f315

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.142-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.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.142-cp34-cp34m-win_amd64.whl
Algorithm Hash digest
SHA256 ebf971383d52d10849f214b936d3f9df05aed574cc6b1062dceffa8b6eeac1ff
MD5 0275ebec8c19274a4199c344d36cd848
BLAKE2b-256 a51d9326d8fb355e26694b4051c0ba05c03f9a52cbe331fe4fe958c07d469a7f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.142-cp34-abi3-manylinux1_x86_64.whl
  • Upload date:
  • Size: 21.9 MB
  • Tags: CPython 3.4+
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.142-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5f02924db496e8f4d8f930864393f6f0ed991a76f7c18785de952810e7f39841
MD5 b391d33e73471540f3ffa36f067f6227
BLAKE2b-256 dabc3cefff66f7d40d76a2250e2ed1c754e160f312e3e37162b813a0f17137a2

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for hdbcli-2.4.142-cp34-abi3-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 f95f13fb98f302ce64c9d8d57bc6c409a3a6a61ae4cbef6a21c5e0840ca05848
MD5 4277e8f15b0a78db6ded9817bcce1078
BLAKE2b-256 933b60c5bf8b9ce7de39d5353669000a49cdfe6cbe47e422e7920dc7947c3a91

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.142-cp27-cp27mu-manylinux1_x86_64.whl
  • Upload date:
  • Size: 21.9 MB
  • Tags: CPython 2.7mu
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.142-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9232f097be7188a080f3a6358bc570856995bfb4c825cc2f081493f68d5fb61a
MD5 bbd5237b94d5efaa6941a7bd05ec5cc4
BLAKE2b-256 9a2663fffdafe0bfb5d103e069c3a832db26d4c60d8558e3a2afeb7f09f561e1

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for hdbcli-2.4.142-cp27-cp27mu-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 518b87d4e45eb78f8fa1a3a9610e3a56db639c19a97f559e8d5db6ec946f9cf8
MD5 37d7be436b6b8267ac2b3e379708668b
BLAKE2b-256 6df19ef12613bb47ee3a3d659a8b9662fe0cd3e7f26baa64881be2d713f54633

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.142-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.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.142-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 81412371c958562cace63ba1341e570c27951b466a73bdfad54006300ee6d9f6
MD5 43cf3b1f5bc14f2f41c1942598c8292c
BLAKE2b-256 8586589a63ffb8101c0d6df5507f74595f4dcdb3966f4652db1ac16ac2597407

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.142-cp27-cp27m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 21.9 MB
  • Tags: CPython 2.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.142-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 40316507ad9d360591b0d2aa14344d2be67c64c1cd14021777256db417268626
MD5 83337d5ff6631728eac960043c04e124
BLAKE2b-256 c85cffd2f73360088f7c6e465ce3da3f048dbab2cf9f8beda0e529b8fb960f55

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for hdbcli-2.4.142-cp27-cp27m-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 aa9a25dda228ccac52f036b0b19d8629316987b1a8b2770caadeccc29355e1db
MD5 4798e89ad9b49cefe1c36710a5f42d38
BLAKE2b-256 1a7987a1b979cb007935a53b08f6ef32a561e42294d89a1b5aa2ee79cf49796c

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