Registry / database / pyhdb
library0.3.4pypypi✓ verified 86d ago

PyHDB is a pure Python client library for connecting to SAP HANA databases. It implements the SAP HANA database protocol (based on Python DB API 2.0) and supports features like LOBs, geometry types, procedures with resultsets, and SELECT FOR UPDATE. The current version is 0.3.4, released in December 2016 with bug fixes. The project is in maintenance mode with no recent releases.

pip install pyhdb
INSTALL
IMPORT
SIG · PYHDB
P
pyhdb
databasepythonv0.3.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Connection
from pyhdb import Connection
from sap import ...
The correct package is pyhdb, not sap or hana_client

Connect to SAP HANA and run a simple query.

from pyhdb import Connection connection = Connection( host=os.environ.get('HANA_HOST', 'localhost'), port=os.environ.get('HANA_PORT', 39013), user=os.environ.get('HANA_USER', 'user'), password=os.environ.get('HANA_PASSWORD', 'pass') ) connection.connect() cursor = connection.cursor() cursor.execute("SELECT 'Hello, World!' FROM DUMMY") print(cursor.fetchone()) connection.close()
Debug
Known issues
deprecatedPyHDB is effectively in maintenance mode. The last release was in 2016. Consider using the official SAP HANA Python driver 'hdbcli' instead. SAP has provided hdbcli as the recommended client.
fix
Switch to 'pip install hdbcli' and use 'from hdbcli import dbapi'.
affects: >=0.3.0
gotchaPyHDB uses Python 2/3 compatibility via 'six'. On Python 3, ensure you have a recent enough version to avoid subtle encoding issues with strings.
fix
Install or update 'six' to the latest version.
affects: >=0.3.0
gotchaThe connection parameters 'host' and 'port' are required but often misconfigured. The default port for HANA (3xx10) is 39013, not the common 30015. Using wrong port will raise a timeout error.
fix
Verify the correct HANA port with your administrator. Common ports: 30015 (MDC), 39013 (tenant DB).
affects: all
breakingIn v0.3.2, the 'connect' function was renamed to 'connection'? Actually, check the README: the correct class is 'Connection' from 'pyhdb'. But there was a change in connection method signature. Ensure you use 'connect()' method on the Connection object, not 'open()'.
fix
Use connection.connect() after creating the Connection object.
affects: >=0.3.0
Errors
Common errors & fixes
ImportError: No module named pyhdb
PyHDB is not installed or installed in wrong environment.
fix
Run 'pip install pyhdb'. If in a virtual environment, ensure it is activated.
pyhdb.exceptions.OperationalError: Connection refused
The HANA host or port is incorrect, or the HANA instance is not reachable.
fix
Check host and port values. Use 'telnet <host> <port>' to verify connectivity. Ensure the HANA instance is running and listening.
AttributeError: module 'pyhdb' has no attribute 'connect'
The 'connect' function is deprecated or not available; use Connection class with connect() method.
fix
Use 'from pyhdb import Connection' then 'conn = Connection(...).connect()'.
Upgrade
Version history
0.3.4latest on PyPI · released Feb 16, 2018
Audit
Dependencies
sixrequiredUsed for Python 2/3 compatibility
Agent activity
9 hits · last 30 days
node
8
Resources
pyhdb — pip install pyhdb · libregistry