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

Uploaded CPython 3.7mWindows x86-64

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

Uploaded CPython 3.6mWindows x86-64

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

Uploaded CPython 3.5mWindows x86-64

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

Uploaded CPython 3.4mWindows x86-64

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

Uploaded CPython 3.4+

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

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mumacOS 10.6+ x86-64

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

Uploaded CPython 2.7mWindows x86-64

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

Uploaded CPython 2.7m

hdbcli-2.4.162-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.162-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: hdbcli-2.4.162-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.162-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 d8e6af2c5c8dbb13f8102aae642d06a8e7da2f7f0d28ca8d0a5174e7944c3403
MD5 be069616b7dd95be981be6693ab69904
BLAKE2b-256 815af8be59fde3037ea5181e52dc1d0891e9a7843138718408e2aa5da3008f1c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.162-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.162-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 d6f598217ed7a2329713b27a5d723802156ee5d0fa27333a51d78b59a9194f4a
MD5 1b2e77ae1582ded21b8b9157d05cb437
BLAKE2b-256 40a9964172b51fec72bd622ad862748c8839da8467e72bcc4724ef715ee120e7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.162-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.162-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 13982fb588110a39729edcdf126a9560fbddc150f53ffbc19c482b69d0eb8044
MD5 e23d2f9d6cb754afcc305207a13ccac4
BLAKE2b-256 8c53cffd21576c965ddcb270ae7553e3d1b29c392a3d7ffb58d4e35e43a3f3c6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.162-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.162-cp34-cp34m-win_amd64.whl
Algorithm Hash digest
SHA256 f6c14a35572965e766675e59748c2d98d7dde0170fcf3efe4ed4bdf05c9a9731
MD5 f79f467f2c8afec92dc11832b94162cc
BLAKE2b-256 adda0bbb1989e7205c4bfd4c8f4807bfc2b17d816e8f0204793ba7e2fadc2eb3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.162-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.162-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1f4bac7a903ecaaf76c2a8cca614a3467ba4ab36cc60776102764404b61d282a
MD5 1e65657f00ab87ed9ac2e12fbba3d501
BLAKE2b-256 0c8a959a56f84ce3924850f681c77764b113eb3e64d7784363033c211735cc6d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.162-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.162-cp34-abi3-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 38f6b37cd30597d0c288b9c0bc5deadfb392e802cdc88f61fb54ef773f0286ea
MD5 33107e9480bd42bbe1c3bf05a99513ec
BLAKE2b-256 103bb611b7036e74c590c0c034e5ac60efd7d825f51b27790a5971dc0957e4d5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.162-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.162-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d272e3107fd68c17ca5cddebb45a2c85b6ab1e989bbdd91f5c9400120edf8f76
MD5 dfe8721d9edfab814a60b281196bde69
BLAKE2b-256 bbebd3f19ca6286086db18fa8a8bff24cc760d29ae31fea820eb2bfb7024c496

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.162-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.162-cp27-cp27mu-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 4ba0b679be78b3693caf59ffa9859c6a8462681791eb8b89e5e4a2f3de6fdde6
MD5 009087e2ed378e4baf9df9e33f50928d
BLAKE2b-256 835e15d241debd3c57e3ddeb1bbbd47bad71620a710abc1bf15ea89ac5898e09

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.162-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.162-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 5e8ef21003b1d7a54be25416918fe51ce09f6da48157b5dc57ff560c1136dc39
MD5 8d2baea4fdff84f4163ce7497cea05df
BLAKE2b-256 d91b8e4e04f938de5f15b5636e0e3129cebd8e908004b7c6d65153c12aa3b795

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.162-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.162-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 623cf824f44290c717426597c152ac6c3597fc1a66fea184a04458a8eb8cad30
MD5 9082db49aff21c0595fb3de68268c9db
BLAKE2b-256 9476281f27d28b5e3b8ca49b635d1a10e1614886122f7b41db9fe063b61263ce

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.4.162-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.162-cp27-cp27m-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 6b0154264ea878ebd75054b6254caf74e316cb0e7fbc379048ea21eeee96856c
MD5 bde465c0815e6c2e7c86fbdb5d02728f
BLAKE2b-256 611d4e58553ada57b26b27fc09988eeadc1cf5437ad603b814d56bd05d9727eb

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