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

Uploaded CPython 3.7mWindows x86-64

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

Uploaded CPython 3.6mWindows x86-64

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

Uploaded CPython 3.5mWindows x86-64

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

Uploaded CPython 3.4mWindows x86-64

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

Uploaded CPython 3.4+

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

Uploaded CPython 2.7mu

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

Uploaded CPython 2.7mumacOS 10.6+ x86-64

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

Uploaded CPython 2.7mWindows x86-64

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

Uploaded CPython 2.7m

hdbcli-2.4.171-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.171-cp37-cp37m-win_amd64.whl.

File metadata

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

File hashes

Hashes for hdbcli-2.4.171-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 7039755321d4da8db79f0e31029aed26bcfc92d3231d947e7e1341e481ddd422
MD5 fcbc71e044c5c1bd6707caf645e7754e
BLAKE2b-256 748deaf3f1f69f6a470123def5f1d3db4d1c52d0715ccc6937494c4243a394eb

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for hdbcli-2.4.171-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 c8abb3ddd9c780a40c920c8e565b54261543b2d3aa24fda6b415c7ac112773cc
MD5 f3623717feb8b94f54607b1ccad408df
BLAKE2b-256 4be75adf279562298090a358a31ecdb7523f882765246360f74fefb77c6e0872

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for hdbcli-2.4.171-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 1c84c8de685d47bb27809521370d6271ceaca10cfdb21ae30d4953a40cd62c2b
MD5 ab4504414919eab53ac5d7f79fc9196c
BLAKE2b-256 ee6ba158959fa8298f2c5b62b1373ebae81a2e1ec6303313be9abe6904d6253b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for hdbcli-2.4.171-cp34-cp34m-win_amd64.whl
Algorithm Hash digest
SHA256 e158f159a5006af34386b509d0a1e41df5a27ef1ff1d2e0d3c40ad7bdf46d4d2
MD5 53c5445149f6627613920ba46e7fe35e
BLAKE2b-256 7a09c5d99965e733851bd957dbc4f39984bfdc0b347682f14df50bf3831ae6d0

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for hdbcli-2.4.171-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5492dbe98c725bff81b699429dd532774bd892899a1131289bd9373fb5feb084
MD5 657d9538caa9b39829c55ebacdcc4264
BLAKE2b-256 831d75c9725c74811b4126a7c640d8623f93235d712a7ce5e13bb58312c9375e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for hdbcli-2.4.171-cp34-abi3-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 bf39b42e791b78c4f028e218359dc7c66057bae0bb4912742d89040295d04159
MD5 30a78881a67f0eb17ea392c55109abb0
BLAKE2b-256 0889001eb09623cc0464de27a72e39bf8c1f06a570f090ec772ddf5ee7f98759

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for hdbcli-2.4.171-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e4f42e484544e300f4fa13bcc98698e2cb6adc71269f03c66ec9bb58fcf12932
MD5 e327351d35074ef6a3c8add1f46530cc
BLAKE2b-256 d0ce1f2e3d5358d0a7dd1be7c3c4b8ba89c975b52c51c339e24b4c498e69c80c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for hdbcli-2.4.171-cp27-cp27mu-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 33b2b713540e6f5bad6fe1f3271a3b6a079963246257811751e264b2690e1441
MD5 a0bbb9bbd1e4974847ebc4f21841abbb
BLAKE2b-256 36337d602b188870290b9223dd140a6f9d66ce366ddca9aeadf6e55e4038e34d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for hdbcli-2.4.171-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 cbfbed0a575ea4a2159d413d447035986c33762c99508a1257419c131af44a44
MD5 fffe98fc05d143c3630df0a72d527efc
BLAKE2b-256 bb7f29ea6fd639a9eb29e954e334def230d6cb006cd6eb4fb7bd5052e79003c4

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for hdbcli-2.4.171-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 86dbb0382a652c5e3b2f41d185088d920a217767a81beb7024c0673903ef022b
MD5 f37de66db17d37a873385d36ffa35ca9
BLAKE2b-256 73994625026517d39d91d45be5d67e2ce7757916c195ffae5f9f95b1d7b295d2

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for hdbcli-2.4.171-cp27-cp27m-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 abdb3c834eed6283fc665b63852cf491965cbe1b6753b86dc0e4e6f59898628f
MD5 ff000eb060c86eeebc8c7a0afe72e3aa
BLAKE2b-256 836c3d10cca734cec31a54328553da6c928b682379ad2096192bffb2eb169741

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