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

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

Uploaded CPython 3.8+macOS 11.0+ ARM64

hdbcli-2.21.28-cp36-abi3-win_amd64.whl (3.6 MB view details)

Uploaded CPython 3.6+Windows x86-64

hdbcli-2.21.28-cp36-abi3-win32.whl (3.6 MB view details)

Uploaded CPython 3.6+Windows x86

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

Uploaded CPython 3.6+

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

Uploaded CPython 3.4+

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

Uploaded CPython 3.4+

hdbcli-2.21.28-cp34-abi3-macosx_10_11_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.4+macOS 10.11+ x86-64

hdbcli-2.21.28-cp27-cp27mu-manylinux2014_ppc64le.whl (11.0 MB view details)

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mu

hdbcli-2.21.28-cp27-cp27mu-macosx_10_7_x86_64.whl (5.5 MB view details)

Uploaded CPython 2.7mumacOS 10.7+ x86-64

hdbcli-2.21.28-cp27-cp27m-win_amd64.whl (3.6 MB view details)

Uploaded CPython 2.7mWindows x86-64

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

Uploaded CPython 2.7m

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

Uploaded CPython 2.7m

hdbcli-2.21.28-cp27-cp27m-macosx_10_7_x86_64.whl (5.5 MB view details)

Uploaded CPython 2.7mmacOS 10.7+ x86-64

File details

Details for the file hdbcli-2.21.28-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hdbcli-2.21.28-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 162f4a5b25013ce5806679df4bab186989886cb64223e75545ce58f5de1a98d0
MD5 d93038636a0175c9e72b6f3c118e35b5
BLAKE2b-256 38f0ae6433acc40a40c2ac418089732da396d75aaccac62dfe3706ac53ab5c52

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.21.28-cp36-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.6+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for hdbcli-2.21.28-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 894c45cfec072b68dfa8fedc67cc45156588708a6dee3709fd96d1282abbb0ca
MD5 aa801bdf431ec025b783c70c51a67153
BLAKE2b-256 4150e72cb095600d198f7748ce06fd2396502660f62d80bc9c29644e4fa40736

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.21.28-cp36-abi3-win32.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.6+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for hdbcli-2.21.28-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 922272f7d1f308d2875a51d7291fd4d624428f402fd1fe389d1cf0002582ac29
MD5 b017d1e8ec59bb7e336cdd0363e8bb25
BLAKE2b-256 7b7612de57c49f929f8dc502b9d1553b6c0fc3e0febd4bc23c9c8e1acad487bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.28-cp36-abi3-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6f1240de9d4b43ba17bce839d86304f35df88dc80c4fb49030c1b3cbc9a7cf07
MD5 e165a903fcc70af9c8ca79adef25610c
BLAKE2b-256 98dfdfd87ad2f9905e60b4a7a861f2cc3e563938fa98f84a187929dc4d6a12d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.28-cp34-abi3-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 2a10cde6c2e0baaa369c38921d45b1e7c37948e09ad568b9e186b983ce4b4f61
MD5 5c4b2419985938b087f6e1b070d29a9d
BLAKE2b-256 99b971d2c12e4002ead6f646328561e949d8a44e318e5cf9b88c644928b0470f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.28-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7e995e431151b1295184660f61e7f91d3d6d875af1122e577615ab87dbacf58c
MD5 85657f53ca25b5dc547699c4de52404f
BLAKE2b-256 413d791f67878e07c271c795c6684e142ca959b7dc880f472fd124adf82ab318

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.28-cp34-abi3-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 0383cdd894008d0a7067a7b7715827c2a9d38c0c98b4b397491d9bb84ac80dc1
MD5 d6824a1b48d0b88ef457616d9f67c1c1
BLAKE2b-256 9d0699af2683a3626eb335cf2389e295aa215592b98ce56a491ffee313833760

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.28-cp27-cp27mu-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 cba81a6adc545e5c562f4e24628ee07d85e64df798d8a274499e436633897483
MD5 2cae9b98676e4ac71f7084e668910709
BLAKE2b-256 31b85e56a13ba153b3ed34f96cf278dd87614a358b87201728936feacca8292b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.28-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ffa5e5af5b4cf1323e019f08c2d70a88f192ba637f744ef7fdcf102ca5536d74
MD5 9f0d08791205331565f7608ee31bbd25
BLAKE2b-256 612547c8d31d129fe77bb4c136f81b26c8fc720ece3f785b7d0daf27bcd73625

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.28-cp27-cp27mu-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 179352394d370ee1ee8237975acb4fa714b547f3335acde32cd4b532acdcb134
MD5 574f2649acba86cc385d68108e0d6006
BLAKE2b-256 37b79bcaed030bdfda618c813b1a301f615424f9fe5cb99ee8897e114087938d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.21.28-cp27-cp27m-win_amd64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 2.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for hdbcli-2.21.28-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 98449f31282a562a562a653d8e75d3017c65259d9e9fa3b8c24b04f6feb2e234
MD5 b1d166ebdf0ab6d7dbf2e877713cfaaf
BLAKE2b-256 5706ef889510ce9524ddeeb0ddd5b5e122f48540d95183289b4e2bbb252a470a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.28-cp27-cp27m-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 dfd9afd0d32755ee1daf08a6582749057d43913ed03e251b667b7d58d5249b96
MD5 3f212656ff61aa304b2e6c267df268e8
BLAKE2b-256 0e8de9636c7162fd2b4dcbd0ca502d8e81e5c2328c8f1e849166aa542693cb52

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.28-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8c09504ebce566729379ae010620f6383bd97d4257e6e2feb830aa49f5598372
MD5 8943c8233460c3299caed3a841ab5076
BLAKE2b-256 34b93be8d44e6ca6f9fd6858d26b759124c25bb516f163d80c1bd683ad6edaea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.21.28-cp27-cp27m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 bcb5d0b33ab9c7965a08e42453ac9d4f4601a76bd111d82063f9eebe1483c9f5
MD5 73e5099c2d706a7429c9682485f30aff
BLAKE2b-256 35d5b9cdd1aed7a353d8885937711f65b8768b75af4e060f97bad960188dfa84

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