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
Built Distributions
File details
Details for the file hdbcli-2.4.177-cp38-cp38m-win_amd64.whl
.
File metadata
- Download URL: hdbcli-2.4.177-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.41.1 CPython/3.5.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ea648beb3d38b313bc5e41348b992a476bd6f789228efabe0fd158f175e4f2e |
|
MD5 | 7bce73c721a164a643b9a6bf7194b60c |
|
BLAKE2b-256 | b29cd4c1ffc6e6fc7e038c0e8873574877606fa507d9bcf63640f648f8193795 |
File details
Details for the file hdbcli-2.4.177-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: hdbcli-2.4.177-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.41.1 CPython/3.5.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26efcf63525a96d95b1a729866700370bb29ebcac64393fedf00400f99c96ccb |
|
MD5 | e75b04022fe22a6e33f30ed9416bce72 |
|
BLAKE2b-256 | afa8795aabc2c563184980a7a908d407de117dca2f8f02e919e701d6eded3809 |
File details
Details for the file hdbcli-2.4.177-cp36-cp36m-win_amd64.whl
.
File metadata
- Download URL: hdbcli-2.4.177-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.41.1 CPython/3.5.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0832d6696516a5935cc2e084774b145d9dea65497ff2577d38aaca6b209cd6cf |
|
MD5 | e6236c30653ef114ef431321bbf26113 |
|
BLAKE2b-256 | cdce1a59a66d1a8f6723bdf6a13c52c4a3169de9e5b51a561d276f38f3b47db2 |
File details
Details for the file hdbcli-2.4.177-cp35-cp35m-win_amd64.whl
.
File metadata
- Download URL: hdbcli-2.4.177-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.41.1 CPython/3.5.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42253d4c3b9f7a8cc03c541b4fca153e3227c89f6546257c70edc21a3a75af1b |
|
MD5 | 3f695bb49183fc036fa22e32b218ebdc |
|
BLAKE2b-256 | 5bbda354db055860f88315e1288229ca8ff06ac419265cf712a80309fe39c7c5 |
File details
Details for the file hdbcli-2.4.177-cp34-cp34m-win_amd64.whl
.
File metadata
- Download URL: hdbcli-2.4.177-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.41.1 CPython/3.5.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9b2f50d8bc863e22ba71f9aa3ecf6f00397996a72b18ba91a246950b48751e7 |
|
MD5 | dda62707ca055ceaedd5f3048cd8f6dd |
|
BLAKE2b-256 | c2efd53995c18c617ef342ceb145025126e4cbc789a3811ce130e3022c5e0b80 |
File details
Details for the file hdbcli-2.4.177-cp34-abi3-manylinux1_x86_64.whl
.
File metadata
- Download URL: hdbcli-2.4.177-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.41.1 CPython/3.5.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ac1b4659c21ea9a511041e10c20e74046325113549d132257003c552a616edf |
|
MD5 | 217493a2e969557d3d33fc67894f9959 |
|
BLAKE2b-256 | f70aa7ee978ed944c80f024636e9b407e2ea66e621ca65030832883c677a85de |
File details
Details for the file hdbcli-2.4.177-cp34-abi3-macosx_10_6_x86_64.whl
.
File metadata
- Download URL: hdbcli-2.4.177-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.41.1 CPython/3.5.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b3187fe4a7cc99cf0d17f1aab4bd5f46587485f9cdc33cf41a429396f18798c |
|
MD5 | ed706f4226f5773e155a297de7cbe185 |
|
BLAKE2b-256 | 805178f2dca9b0a1b5dd0dc4f8840bea1e6c5b2ed1e04f1d24bf314acbe93b6f |
File details
Details for the file hdbcli-2.4.177-cp27-cp27mu-manylinux1_x86_64.whl
.
File metadata
- Download URL: hdbcli-2.4.177-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.41.1 CPython/3.5.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a082c261e26a6276708ee47e87b907806fa2782c965c3ec440ca54ec9796b37b |
|
MD5 | 3199630950cca15deeb761b39fa9f02f |
|
BLAKE2b-256 | 76d62110e0d9865ad95943368c3d782fc52251d566279d2a44d8f05ed5237a0b |
File details
Details for the file hdbcli-2.4.177-cp27-cp27mu-macosx_10_6_x86_64.whl
.
File metadata
- Download URL: hdbcli-2.4.177-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.41.1 CPython/3.5.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fe3590475ee29d0d5f0e0b937f20f3a0c5130fac13a60432f93f29f2355911d |
|
MD5 | 315e10dfe2a2e817d1d1c2c8f081ac31 |
|
BLAKE2b-256 | 223e9673afce5472d818daa49453f3a865d0d0db5ae9d19bbf71ed7443b54690 |
File details
Details for the file hdbcli-2.4.177-cp27-cp27m-win_amd64.whl
.
File metadata
- Download URL: hdbcli-2.4.177-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.41.1 CPython/3.5.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cf16f8975cbd9d4aa317c04c81eba3f4a1c8f095b0dff29bab65ca81497a502 |
|
MD5 | 94e2bfa69f9c7a3144dd03f9a9fd23dd |
|
BLAKE2b-256 | 27ba56f8db26066ef28643b99520e9aa3bb1e9ea82ce4034395adefa4a11acca |
File details
Details for the file hdbcli-2.4.177-cp27-cp27m-manylinux1_x86_64.whl
.
File metadata
- Download URL: hdbcli-2.4.177-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.41.1 CPython/3.5.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2ce812a1f9d083182726fc1e2f26ac33f4c27664bbcdaf1b383ba680b7c6ba4 |
|
MD5 | f5de8f8ac75690432fcd55724fc6c065 |
|
BLAKE2b-256 | 7a0b6383eef1663615a8e6d01c19d6c079bee1daede854b68f28397f2b41313a |
File details
Details for the file hdbcli-2.4.177-cp27-cp27m-macosx_10_6_x86_64.whl
.
File metadata
- Download URL: hdbcli-2.4.177-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.41.1 CPython/3.5.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41fe605431de0e1494b10df1b4ee2c92cab6815cb3ced3c878e7d8e4d7969c7b |
|
MD5 | 58a17ba7c05f9fad4ad7ca1779e0f13b |
|
BLAKE2b-256 | 9784db3438275e2aa658ab11bab234936e7209989a8db230d591c3787f0553f0 |