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

Uploaded CPython 3.7mWindows x86-64

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

Uploaded CPython 3.6mWindows x86-64

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

Uploaded CPython 3.5mWindows x86-64

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

Uploaded CPython 3.4mWindows x86-64

hdbcli-2.4.151-cp34-abi3-manylinux1_x86_64.whl (22.3 MB view details)

Uploaded CPython 3.4+

hdbcli-2.4.151-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.151-cp27-cp27mu-manylinux1_x86_64.whl (22.3 MB view details)

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mumacOS 10.6+ x86-64

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

Uploaded CPython 2.7mWindows x86-64

hdbcli-2.4.151-cp27-cp27m-manylinux1_x86_64.whl (22.3 MB view details)

Uploaded CPython 2.7m

hdbcli-2.4.151-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.151-cp37-cp37m-win_amd64.whl.

File metadata

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

File hashes

Hashes for hdbcli-2.4.151-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 bbfb3408a9675407ed9dbf3f193bb6f5c82cab6c1de25fd54ee6f777dd66bfd3
MD5 87c657ccc0f2717ff68459caebdacbf8
BLAKE2b-256 33857a1f2d00048adb8680ded295aef06defe66f58e7d10dadd716c17addf89c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for hdbcli-2.4.151-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 ccac94f5e48a0ce2b4c3b2bc1739516ddc31daf2c475d45261e58ed4df7cd973
MD5 48bc2132f30dc120b2911f1b661f99aa
BLAKE2b-256 306f3ae0b1754c6e5f920d766dd497cf64af763178cd20dd09c97924d0d737b6

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for hdbcli-2.4.151-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 77fab9585bb98b04e730bd83f6c161342f6f1082b9dc684eb475f00a7c492a49
MD5 4778a9499e7d881ba4c0b86f2684a221
BLAKE2b-256 5a75a43ddae4a5366b6da8df02408bccdb7f61b04e6c9fdbcf8b280d3c49a8b0

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for hdbcli-2.4.151-cp34-cp34m-win_amd64.whl
Algorithm Hash digest
SHA256 281d87fcf9c22d6683385e9f0ee37775f7d8c915bba9e02c692356ef9fd7b5f6
MD5 235753f85c990be0f254ac22d4502d78
BLAKE2b-256 4b0afa5dc3be48d61a0d0c77ad68fda41234257a5e40a1531a6765695d9cf7be

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.151-cp34-abi3-manylinux1_x86_64.whl
  • Upload date:
  • Size: 22.3 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.35.0 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.151-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3f9178dff84f6186d1627c70c402fe993df59c4ee5515566fe9cc5f427dea726
MD5 eb79ba3cf4bcb72a513f01488324def4
BLAKE2b-256 033c0ba9310c079cfa319e3a1abee24a0e976e63d544a6226cf3256b7e9e52bf

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for hdbcli-2.4.151-cp34-abi3-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 0d13186619e9ea253088a1c163f75aaf59619bf8639f05cd5d45866f7d7d8451
MD5 976b098932bc25a3d66a712ea8d0ac0d
BLAKE2b-256 b63fa636ad0a3f18d05c73c07121e5f7c97ea7f404b799dd01ca581872a019cb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.151-cp27-cp27mu-manylinux1_x86_64.whl
  • Upload date:
  • Size: 22.3 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.35.0 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.151-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d4d0f7672032256112b8c00de59d11b8ca7f9a6b53d7b8aedef4e641ecfd4719
MD5 c79f04f64573b7f0d9b700435753b73e
BLAKE2b-256 d09a0fd7c78aa8b4c593c98575158e02a4f4e90a98120247697d8b83b787465e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for hdbcli-2.4.151-cp27-cp27mu-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 9c2bc13e62fd9f1e86ba25fc92ef3ebfc6c363b9a03a4d66e41a4752f5e8d6e6
MD5 cd68eebb371a1c555dcc132c81bbbf72
BLAKE2b-256 f8c14aed145ad1e7a7d842f8ef42e4f7b372b6c75f80cab40ef51a2cf5f109b9

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for hdbcli-2.4.151-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 1b28dbb56c6c713ccdc352269b24a936d4564962eadefd7dd367dca287213b91
MD5 a98e9dbc766c06e1a19fa8e6862f7325
BLAKE2b-256 bb0001674c52062b895c35e33864a737e66ffd1fc6cf2e937601a8455aaafd8e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.151-cp27-cp27m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 22.3 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.35.0 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.151-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ec23d3c207782d1d5ea80e66fa7eb6e433d8550cac60628caf5dc8cf44f12ed0
MD5 5b2503befd8c6d7dc77b4577f38a640b
BLAKE2b-256 8093fd60a841c009fa2619bfa5fa0a17a143447dc4b6d5ee2acc7fb109a9631d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for hdbcli-2.4.151-cp27-cp27m-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 b4fbb65163f0807dc6f34e5f79994e9def1c8e92ea1d2735d197cfd698320464
MD5 d6936b964a57a66c6f2ad77ad34a1079
BLAKE2b-256 72582925b7d91c1c334fdc71198d517d27a502e5dfc70ad3944d1b64295b6724

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