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

Uploaded CPython 3.7mWindows x86-64

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

Uploaded CPython 3.6mWindows x86-64

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

Uploaded CPython 3.5mWindows x86-64

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

Uploaded CPython 3.4mWindows x86-64

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

Uploaded CPython 3.4+

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

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mumacOS 10.6+ x86-64

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

Uploaded CPython 2.7mWindows x86-64

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

Uploaded CPython 2.7m

hdbcli-2.4.155-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.155-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: hdbcli-2.4.155-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.0.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.155-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 5d292198459271e92e1385fc2d0bce7d9df4815ca71cb5f101b76f5990ecf168
MD5 3347480fe76fb7d0aff299decdf29e44
BLAKE2b-256 8a5d7e17ed84d7078bc8ae84cfd861657beb2fd9d566a116881ad0520d4e2bda

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.155-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.0.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.155-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 bb39c48b0a42b1ea6e55dfe31bceba357377e8d436ec7919ecbf7c7f472a2211
MD5 80cc60aa54a0c960708c408872a85d4d
BLAKE2b-256 08f8dc768837043b335b28b4b846d0f0d25fb99076a1d4c67c1ab1d51cb1911f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.155-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.0.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.155-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 7e80e36fae1449ac9a0066981e7ae271a1da448f47788ad0b474495a0a64b2a5
MD5 67e6fde5c2856c8612fb3a7216bc2fa0
BLAKE2b-256 d89575afd0fc339e2e3af2b8bd81ead244f2a1a44980dbcf168cece6f93bad6a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.155-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.0.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.155-cp34-cp34m-win_amd64.whl
Algorithm Hash digest
SHA256 7186c1ccdb38f8357fffc6c92c100cb29120ad0d2e90e2d88e3c6dc9ec86ff72
MD5 6755ed3322ec39824ef5fcc99a639975
BLAKE2b-256 dd18f5ba7f0a8e3354f7ba0f8f319b790d436669171c9d0602b1b7a3ccdaff83

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.155-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.0.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.155-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 71b62625868b5063c80491abe6870ad935f0c1b0082b5ceb9ca54dbe866e2771
MD5 e24c0df48797a101a5636500c9061b42
BLAKE2b-256 1a310a11b9f57b54a962c9e0e12dbda6984469b40266189ef61501031dab1007

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.155-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.0.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.155-cp34-abi3-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 de89e33f3ccbe10eb19bb05a0d2f47a2f8242959dc2ecc8c8577bba8def8a198
MD5 05c2526b7e2f236ef32221f7bf247a08
BLAKE2b-256 1cc7f21f7356bef1b592a86d0e9d218454519d39b77089b7660b45a1e9de1050

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.155-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.0.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.155-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f3cd11303c515e081253a7300b0672bc25e0e20e0e0adb2e5d5972219f421270
MD5 f8d8e18de685ee195b2f53a0d9938d1d
BLAKE2b-256 9d27409162e24a9c88ceff39998cfb44e3c377cb7ab36c4af76495083b1ec541

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.155-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.0.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.155-cp27-cp27mu-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 7228913fafdae61a9cc026f2fee9c2c81b3b67920ebacc72a2e59af396a544a1
MD5 58ef6671194701bf0d08504b8165c658
BLAKE2b-256 b9375862518f6da11a20e2918ca04bb08152605ea4efab7325634b00a15dd9c2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.155-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.0.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.155-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 0a640bc239030ba753cf1b7d441d5dee2bba9807f515ee57a2851f8df8dcc141
MD5 eb89a36586ebc215a749fb670ab2713c
BLAKE2b-256 bc525af08bda2c7467d5249b73dd3c31deb94479e7acee9f538f1f0a6db3c29b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.155-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.0.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.155-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 2b4cab42ae20aec1798007e4d7d8d965540074de06013a654744f18341ed23f6
MD5 6e84d6fbf6fb2d12400ad27e7ad05652
BLAKE2b-256 6efed7896368e6ca23c349c4f4bb24421eb544811bfdd6a84679bb331989f64b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.155-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.0.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.3

File hashes

Hashes for hdbcli-2.4.155-cp27-cp27m-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 6b7c77345c4bb820f317bad46a56552d426d689ef3137a71c8d8fe99a21b6509
MD5 f7dbf2bde7e101c119caefd1053eec4f
BLAKE2b-256 fe79cb5d81edb3c33303db2bb5d32052daa08b8aae5c24605c7bc27e8cc28e11

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