Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the differences between PyHDB and the hdbcli python package from the HANA client?

Tags:

python

hana

In order to work with HANA in python, I've always used the pretty old python 2.6.4 that came with the HANA client. There are ways to get it working with other python versions, too, but they seem to by very hacky.

Now I've found the very promising-looking PyHDB project on Github, which seems to do the same job being installed more easy and working with newer Python versions, too.

Which features won't work with PyHDB that worked with the HANA python?

Are there performance drawbacks?


Edit:

Here is what I found using the module globals:

  • PyHDB is more thread-safe (threads may share connections here)
  • the parameter style is different (PyHDB: format; hdbcli: qmark, named)
like image 856
203 Avatar asked Mar 02 '15 14:03

203


People also ask

What is Pyhdb?

Description. A pure Python client for the SAP HANA Database based on the SAP HANA Database SQL Command Network Protocol. pyhdb supports Python 2.7, 3.3, 3.4, 3.5, 3.6 and also PyPy on Linux, OSX and Windows. It implements a large part of the DBAPI Specification v2. 0 (PEP 249).

How do I check Python version in SAP HANA?

Confirm you have a supported python version (2.7, or 3.4+) by typing the following at a command prompt to show the python version: python -V.


2 Answers

Here an update on the current situation:

  • pyhdb supports Python 2.7, 3.3, 3.4, 3.5 and also PyPy on Linux, OSX and Windows.
  • hdbcli has support for python 2.7 and python 3.4+ and is is fully supported and pushed by SAP.

Regarding performance:

  • executemany is an order of magnitude faster with hdbcli

The following blog post contains some further information:

https://blogs.sap.com/2017/07/26/sap-hana-2.0-sps02-new-feature-updated-python-driver/

like image 138
Maik Röder Avatar answered Sep 28 '22 22:09

Maik Röder


The PyHDB is the younger brother of the node-hdb, both implementing the same protocol as ODBC based Python package hdbcli. The hdbcli Python client is a part of standard HANA installation but it does not belong to the list of officially supported interfaces for building HANA applications, to my knowledge. The orientation for building PyHDB was therefore not the hdbcli client but the above mentioned protocol specification and the existing node-hdb implementation.

The detailed hdbcli/PyHDB cross-comparison is therefore not currently available but looking into the protocol specification and READMEs of PyHDB and node-hdb helps getting insight into connectors' features and the current coverage of the specification by both implementations.

Among these three HANA connectors, hdbcli, node-hdb and PyHDB, the PyHDB, being the youngest one, offers atm. the least features and capabilities, missing some features already available in node-hdb, like authentication methods or prepared statements for example. Looking into node-hdb source helps getting the rough estimate of efforts required for building the same in Python.

Rather than waiting for the full coverage of the protocol, which could take a while, the PyHDB is released "as is", but open for receiving input and requirements from projects and offering new features in that direction.

No performance drawbacks discovered so far.

Perhaps worth of mentioning here, the direct connectivity from Python and nodejs (GO should come soon) is also possible with ABAP, via SAP RFC protocol, via PyRFC and node-rfc connectors, which are counterparts of standard ABAP RFC connectors, available for Java and .NET as well.

like image 28
bsrdjan Avatar answered Sep 28 '22 22:09

bsrdjan