Registry / ai-ml / hana-ml

hana-ml

JSON →
library2.28.26042901pypypi✓ verified 83d ago

Python Machine Learning Client for SAP HANA. Provides APIs to access SAP HANA's machine learning capabilities via Python. Current version: 2.28.26042901, requires Python >=3.4. Release cadence: roughly quarterly.

pip install hana-ml
INSTALL
IMPORT
SIG · HANA-ML
H
hana-ml
ai-mlpythonv2.28.26042901
Install
13.6s avg
Import
1126ms
Disk
314MB
Pass rate
9/ 10
Env Coverage9 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.28.26042901 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 13.2s
py 3.11
✓ —
✓ 12.5s
py 3.12
✓ —
✓ 13.7s
py 3.13
✓ —
✓ 13.1s
py 3.9
✕ build_error
✓ 15.3s
314MB installed
● package 314MB
Code
Verified usage

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

ConnectionContext
from hana_ml.dataframe import ConnectionContext
Correct import path for establishing HANA connection.
create_dataframe_from_pandas
from hana_ml.dataframe import create_dataframe_from_pandas
Used to transfer pandas DataFrame to HANA DataFrame.

Establishes connection to SAP HANA and runs a simple query.

from hana_ml.dataframe import ConnectionContext import os # Connect to HANA (use environment variables for credentials) cc = ConnectionContext( address=os.environ.get('HANA_HOST', 'localhost'), port=int(os.environ.get('HANA_PORT', 30015)), user=os.environ.get('HANA_USER', 'USER1'), password=os.environ.get('HANA_PASSWORD', 'Password123') ) print(cc.connection.isconnected()) # Create a HANA DataFrame from a SQL query hdf = cc.sql('SELECT * FROM DUMMY') print(hdf.head())
Debug
Known issues
breakingIn version 2.20, the import path changed. Previously, `from hana_ml import DataFrame` was valid; now use `from hana_ml.dataframe import DataFrame`. Old code will break.
fix
Update imports to `from hana_ml.dataframe import DataFrame, ConnectionContext`.
affects: <2.20
gotchaThe `hana_ml` package name is `hana-ml` on PyPI. Installing `pip install hana-ml` installs the package importable as `hana_ml`. Do not confuse with other similarly named packages.
fix
Use `pip install hana-ml`, then import as `hana_ml`.
affects: all
deprecatedThe `apply` method on DataFrames for user-defined functions is deprecated in favor of `map` or vectorized UDFs.
fix
Use `map` or register vectorized Python UDFs via `create_udf`.
affects: >=2.20
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'hana_ml'
Python cannot find the hana_ml package. Either not installed or installed from wrong source.
fix
Run `pip install hana-ml` and verify installation with `pip list | grep hana-ml`.
DBTError: db error: [SAP AG][LIBODBCHDB DLL][HDBODBC] Communication error -10: cannot connect to host
Incorrect host, port, or network issues. Firewall or wrong address.
fix
Check HANA_HOST and HANA_PORT environment variables. Ensure the HANA instance is reachable. For testing, use `telnet <host> <port>`.
Upgrade
Version history
2.28.26042901latest on PyPI · released Apr 29, 2026
Audit
Dependencies
hdbclirequiredSAP HANA database client driver for connection
Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources
hana-ml — pip install hana-ml · libregistry