skillfed

hana-ml

Python Machine Learning Client for SAP HANA

hana-ml v2.29.26072700 125.5K downloads/30d#11,810 on PyPI114
License unclear SAP DEVELOPER LICENSE AGREEMENT Active released

What it is and what it does

hana-ml is a Python client that bridges data scientists to SAP HANA's in-database machine learning capabilities. It provides a SAP HANA DataFrame abstraction for querying and filtering data without pulling it to the client, plus APIs to PAL (Predictive Analysis Library) and APL (Automated Predictive Library) for training and scoring models directly in the database. The package also includes visualization tools (EDA plots, model reports, Shapley-value explanations), model persistence (save/load/delete in HANA tables), text mining, and spatial/graph analytics.

The package depends on hdbcli for database connectivity and uses pandas, numpy, plotly, and shapely for data manipulation and visualization. It requires an active SAP HANA instance with appropriate security roles and APL version 1905 or higher for full functionality. Typical workflow involves establishing a connection, creating a HANA DataFrame from a table or SQL query, training a model, and predicting on new data—all with computation happening server-side.

Use it for:

  • Build classification or regression models on large HANA tables without exporting data to Python for training.
  • Perform exploratory data analysis on HANA data with built-in visualization and reporting functions.
  • Train and persist machine learning models directly in HANA for low-latency inference in production.
  • Analyze text documents stored in HANA using text mining functions like tf_analysis and text classification.
  • Develop geospatial or graph-based analytics on data modeled as spatial or network structures in HANA.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Connects Python to SAP HANA to build machine learning models and query data directly in the database using PAL and APL algorithms without moving data to the client.

Yes, if you have SAP HANA infrastructure and need to build ML models on large datasets without data movement. The package is actively maintained, supports modern Python versions, and offers low install friction. However, the SAP DEVELOPER LICENSE AGREEMENT is non-standard and requires review; one known vulnerability (PYSEC-2023-172) should be investigated before production use. Not suitable for standalone Python ML work or non-SAP environments.

Install

hana-ml on PyPI

pip

pip install hana-ml

uv

uv add hana-ml

poetry

poetry add hana-ml

Installing hana-ml

Before you install

Low install friction with a pure-Python wheel. Active maintenance with a release 17 days ago. Requires SAP HANA server access and appropriate PAL/APL roles; the package itself installs cleanly but is useless without a running HANA instance and proper database permissions.

License in practice

Licensed under SAP DEVELOPER LICENSE AGREEMENT (not an SPDX standard license). License treatment is unclear; review the full license terms before use in production or commercial contexts to confirm compliance with your intended use.

Quickstart

pip install hana-ml

from hana_ml import dataframe
conn = dataframe.ConnectionContext(address="", port=, user="", password="")
df = conn.table('MY_TABLE', schema='MY_SCHEMA')
df_result = df.collect()

Requires active SAP HANA instance with network access, valid credentials, and AFL__SYS_AFL_AFLPAL_EXECUTE role for PAL; APL version 1905 or higher for APL functionality.

Verify before relying

  • Exact scope and restrictions of SAP DEVELOPER LICENSE AGREEMENT for commercial or non-SAP environments
  • Details of PYSEC-2023-172 vulnerability and whether it affects current version 2.29.26072700
  • Whether PAL and APL require separate licensing or are included with SAP HANA subscription

Package facts

License SAP DEVELOPER LICENSE AGREEMENT (unclear)
Python support supports the current Python release (>=3.4)
Install friction low — pure-Python wheel
Runtime dependencies 11 — hdbcli, pydotplus, Deprecated, tqdm, schedule, prettytable, shapely, plotly, numpy, pandas, jinja2
Maintenance actively maintained — 17 days since the last release
Last repo commit
First released
Downloads 125,519/month — #11,810 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities 1 — PYSEC-2023-172

Evidence: hana_ml-2.29.26072700-py3-none-any.whl

Keywords: SAP, HANA, machine, learning, intelligent, enterprise, cloud, PAL, APL, client

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Science/ResearchOperating System :: MicrosoftOperating System :: Other OSProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

SAP HANA machine learningHANA database Python clientin-database ML modelsPAL APL algorithmsenterprise data scienceHANA predictive analyticsdatabase-native machine learning
sap-hanain-database-mlenterprise-analytics

More Artificial Intelligence packages