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.

Community

SAP Community provides a forum where you can ask and answer questions, and comment and vote on the questions of others and their answers.

See SAP HANA Community Questions for details.

Limitations of 32-bit Windows driver

The maximum length of a LOB column for the 32-bit Python driver on Windows is 2147483647. The maximum rowcount that can be returned for the 32-bit Python driver on Windows is 2147483647.

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

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

hdbcli-2.20.22-cp38-abi3-macosx_11_0_arm64.whl (5.0 MB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

hdbcli-2.20.22-cp36-abi3-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.6+ Windows x86-64

hdbcli-2.20.22-cp36-abi3-win32.whl (3.5 MB view details)

Uploaded CPython 3.6+ Windows x86

hdbcli-2.20.22-cp36-abi3-manylinux2014_aarch64.whl (10.8 MB view details)

Uploaded CPython 3.6+

hdbcli-2.20.22-cp34-abi3-manylinux2014_ppc64le.whl (10.9 MB view details)

Uploaded CPython 3.4+

hdbcli-2.20.22-cp34-abi3-manylinux1_x86_64.whl (10.8 MB view details)

Uploaded CPython 3.4+

hdbcli-2.20.22-cp34-abi3-macosx_10_11_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.4+ macOS 10.11+ x86-64

hdbcli-2.20.22-cp27-cp27mu-manylinux2014_ppc64le.whl (10.9 MB view details)

Uploaded CPython 2.7mu

hdbcli-2.20.22-cp27-cp27mu-manylinux1_x86_64.whl (10.8 MB view details)

Uploaded CPython 2.7mu

hdbcli-2.20.22-cp27-cp27mu-macosx_10_7_x86_64.whl (5.5 MB view details)

Uploaded CPython 2.7mu macOS 10.7+ x86-64

hdbcli-2.20.22-cp27-cp27m-win_amd64.whl (3.5 MB view details)

Uploaded CPython 2.7m Windows x86-64

hdbcli-2.20.22-cp27-cp27m-manylinux2014_ppc64le.whl (10.9 MB view details)

Uploaded CPython 2.7m

hdbcli-2.20.22-cp27-cp27m-manylinux1_x86_64.whl (10.8 MB view details)

Uploaded CPython 2.7m

hdbcli-2.20.22-cp27-cp27m-macosx_10_7_x86_64.whl (5.5 MB view details)

Uploaded CPython 2.7m macOS 10.7+ x86-64

File details

Details for the file hdbcli-2.20.22-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hdbcli-2.20.22-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eff39768fcaa34af1a84f4ef02082aa74bcffc06367da239967244b900e2eaf6
MD5 90c4c75c049bd3d19260203c4d3f5789
BLAKE2b-256 2ac7891c3be151a609f1c51362d4ea634b9130b77511c093a6bc2b10aa20595c

See more details on using hashes here.

File details

Details for the file hdbcli-2.20.22-cp36-abi3-win_amd64.whl.

File metadata

  • Download URL: hdbcli-2.20.22-cp36-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.5 MB
  • Tags: CPython 3.6+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.1

File hashes

Hashes for hdbcli-2.20.22-cp36-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 8b7e25ab0fc41fbd18ec6255f6c8a28b350dde869c4e09b42c5e04e344cdb258
MD5 888ef266cd7a0654c6f6e5a9907ac98c
BLAKE2b-256 369c72611e8a9bfc4f24a088cde84cd73312e8dd10a6c901c4e9df243fa69af5

See more details on using hashes here.

File details

Details for the file hdbcli-2.20.22-cp36-abi3-win32.whl.

File metadata

  • Download URL: hdbcli-2.20.22-cp36-abi3-win32.whl
  • Upload date:
  • Size: 3.5 MB
  • Tags: CPython 3.6+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.1

File hashes

Hashes for hdbcli-2.20.22-cp36-abi3-win32.whl
Algorithm Hash digest
SHA256 fe87be382f869fc14b732ee17c7dbfd08a85d711d8bd78401ad3062afe7d6bbf
MD5 b8fa9066a892e0e8f8088c4dd91238a5
BLAKE2b-256 f4d0bfe6f325516638371aa8d0eeab8683c399033f088287f9932d05d89fa48a

See more details on using hashes here.

File details

Details for the file hdbcli-2.20.22-cp36-abi3-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for hdbcli-2.20.22-cp36-abi3-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 17827a09155f3f7f4603421e8839060b063591e5ba94cdb7668340050337e4b1
MD5 6cac03b4f53f16b38e61d705b15a50e1
BLAKE2b-256 bb1926ae1386c4a91c8392596537df7970719ee8664f84dddb3241f6d9c2691a

See more details on using hashes here.

File details

Details for the file hdbcli-2.20.22-cp34-abi3-manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for hdbcli-2.20.22-cp34-abi3-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 39e85c52c26636c4ddc7e6d1e784a4723cd62b76962a0e58ab6f94d0bce65dff
MD5 140b1f4f535601fd51df6c3d198fefaa
BLAKE2b-256 ca46325e2fea419df5eeff57ca772976a5a1932817d72cd67683176350675b35

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.20.22-cp34-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4b53ea5d75a951d408910db9a0b39c02c10f4da4d7f7f92c327ce3a9e17d3a2a
MD5 a92ab4c942d93b7962fc1d711e3095ce
BLAKE2b-256 e03ad83765c8461e99c05f1e83ca51b44ef1d4dacd3c960a8ff4d7555c45fcd0

See more details on using hashes here.

File details

Details for the file hdbcli-2.20.22-cp34-abi3-macosx_10_11_x86_64.whl.

File metadata

File hashes

Hashes for hdbcli-2.20.22-cp34-abi3-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 2a7f673e9ed65fd201765cbc4aecfd2481a3a963e89c17facd098909e3205516
MD5 3fc3c29d6e40c09d1a0d0dbe3b7937fc
BLAKE2b-256 acc2bc87942980a2317f722d674bcdcc06c305a6228706e8ae47dbadb0c8a2e6

See more details on using hashes here.

File details

Details for the file hdbcli-2.20.22-cp27-cp27mu-manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for hdbcli-2.20.22-cp27-cp27mu-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 63d125951bdd679dfe1d040a398e14dfe655e4223a3aacb7b876fb67a57c3743
MD5 b80dd45a3889a05ce27acc90f342a873
BLAKE2b-256 8591582f5e68504381b35385e777e7459a61cd82dcc3caf485fdcc6ad3a50907

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.20.22-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b9abf269825ff4a2369d871dabf7e70af0c4d5c538873fa8c22a06452c8efc7c
MD5 6c57ef21e4e7701b825f6a2d5209c343
BLAKE2b-256 7d9678d9c3acb1ad2e505827f33b84dfa9f24e7be3839369ec9b38cec28648cf

See more details on using hashes here.

File details

Details for the file hdbcli-2.20.22-cp27-cp27mu-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for hdbcli-2.20.22-cp27-cp27mu-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 4e6ec714daed54faff22d1e484662e1362afbc1bb50c71eec03e50396e69919d
MD5 8f39a0f57fa3f49264b9dcf64f6468a2
BLAKE2b-256 550d4c5305235076205d08bb2f47b3a4ea97e4d94928e0d32db45664cbd7b316

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hdbcli-2.20.22-cp27-cp27m-win_amd64.whl
  • Upload date:
  • Size: 3.5 MB
  • Tags: CPython 2.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.1

File hashes

Hashes for hdbcli-2.20.22-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 380ac0eb65e00f3eeb617e3b91faddf872644b5377685138ed92bed7283e76a5
MD5 a9f7b31235f0f1ed6e27ef644a1f13c4
BLAKE2b-256 16ea423bbd142fd2958d0de21b87df0fa33c763c2b72f7b4dfe990c9ccd492ad

See more details on using hashes here.

File details

Details for the file hdbcli-2.20.22-cp27-cp27m-manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for hdbcli-2.20.22-cp27-cp27m-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 a7d33f38113e872cd8d2fb05871a3df78080f80f2d551164be5e355717475ae1
MD5 c0d8a19d1264375341cc1fbe7295b4a5
BLAKE2b-256 87fc8b51a6e0385087dc74c5741d44e7a572d515fe15a31f1a198e91d1aaee2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hdbcli-2.20.22-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a9a455735f27661f326bde3ecdda96b4cbe860018b7fa80f4f1b293d78918340
MD5 d0b125c847fb2895820f03a4bb6dcb4c
BLAKE2b-256 8f1297f32217e55e280a5c2235c407ba5c7da6587ac52dbaebb2db6e37e5899e

See more details on using hashes here.

File details

Details for the file hdbcli-2.20.22-cp27-cp27m-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for hdbcli-2.20.22-cp27-cp27m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 e9cd5969c4845e3ade1bbf30438bb63e1b6fbeecd61b6d7b0fb7fd4fd9d4e414
MD5 2fea2d4213895e1970131677535ef491
BLAKE2b-256 079ca1ff369ac2d253cdfd8b26c8593b6b2b49709557ae91d9165f11d6e070a4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page