hana-ml — Python Machine Learning Inside SAP HANA Cloud
As of 2026-11-07
What is hana-ml?
hana-ml is SAP's official PyPI package ("hana-ml", checked on 7 November 2026: version 2.30.26091800) that wraps PAL and APL's in-database procedures behind an estimator-style Python API — ConnectionContext, DataFrame, UnifiedClassification/Regression, GridSearchCV, and ModelStorage, which can even schedule retraining. Data stays in HANA unless you call collect(), which brings the result set into Python; the same choice between PAL-style manual tuning and APL-style automation carries over into which submodule you import.
What hana-ml actually is
hana-ml is SAP's official Python client machine-learning library for SAP HANA. The PyPI registry entry, checked on 7 November 2026, is unambiguous: package name hana-ml, summary "Python Machine Learning Client for SAP HANA", home page sap.com, current release 2.30.26091800 — a date-encoded version number pointing at an 18 September 2026 build, which is itself a useful fact: this library ships on a near-continuous release cadence, not an annual one, so pinning a version in a client's requirements file matters more than it would for a typical stable data-science package.
Mechanically, hana-ml is a Python wrapper around the same AFL procedures PAL and APL expose in SQL. It does not implement machine learning in Python; it generates and executes the same in-database calls, then returns results. That's the whole design point: a data scientist gets a familiar, scikit-learn-shaped API while every actual computation still runs inside HANA against tables that stay in the database unless you call collect(), which brings the result set into Python.
Why it matters
- hana-ml's version number is date-encoded (2.30.26091800, checked on PyPI on 7 November 2026) — this library ships far more often than an annual data-science package, so version pinning and re-testing cadence belong in the project plan, not an afterthought.
- hana-ml doesn't add new algorithms of its own — it's a Python front door to PAL and APL; a consultant who treats it as a separate ML library will misjudge what's actually available.
- ModelStorage's scheduling methods (set_schedule/start_schedule/terminate_schedule) mean retraining orchestration can live inside the same object that saved the model, which changes how an MLOps conversation for a HANA-based model should be scoped versus a typical external ML platform.
Key points
- hana-ml is SAP's official PyPI package ("hana-ml"), "Python Machine Learning Client for SAP HANA" — checked on 7 November 2026 at version 2.30.26091800, a date-encoded, near-continuously released version.
- It's a Python wrapper, not a separate ML engine: hana_ml.algorithms.pal wraps PAL, hana_ml.algorithms.apl wraps APL; all computation runs inside HANA.
- Push-down pattern: ConnectionContext opens the HANA connection; DataFrame wraps a table/query, and operations like .head()/.dtypes()/.count() execute inside HANA.
- UnifiedClassification/UnifiedRegression (func parameter selects the underlying algorithm) are the estimator-style entry points; GridSearchCV/RandomSearchCV drive hyperparameter search.
- ModelStorage saves and versions a model (save_model, list_models) and can schedule retraining directly (set_schedule, start_schedule, terminate_schedule).
- Installed with plain pip install hana-ml; the HANA side needs PAL/APL (the AFL component) already installed and licensed.
- SAP's own sample repository (SAP-samples/hana-ml-samples) mirrors the PAL/APL split in its own folder structure — Python-API/pal vs Python-API/apl notebooks.
Terms used on this page
- ConnectionContext
- hana_ml.dataframe class that opens and manages the connection to a SAP HANA instance.
- DataFrame (hana-ml)
- A wrapper around a HANA table or SQL query; operations execute inside HANA (push-down), not client-side.
- UnifiedClassification / UnifiedRegression
- Estimator-style classes wrapping multiple PAL algorithms, selected via a func parameter, with scikit-learn-like fit/predict methods.
- ModelStorage
- hana_ml class that saves, versions, lists and can schedule retraining of a model stored in HANA tables.
- Push-down
- The pattern where computation runs inside the database engine against data that never leaves it, rather than pulling rows to the client first.
Sources
- PyPI — hana-ml package registry entry (name, version 2.30.26091800, summary), fetched 2026-09-25
- SAP-samples/hana-ml-samples — DiabetesUnifiedClassificationHGBT.ipynb (ConnectionContext, DataFrame, UnifiedClassification, GridSearchCV, ModelStorage, set_schedule) — GitHub (SAP), fetched 2026-09-25
- SAP-samples/hana-ml-samples — Python-API folder structure (pal vs apl notebooks) — GitHub (SAP), fetched 2026-09-25
- SAP-samples/hana-ml-samples — README (project scope, PAL/AFL prerequisite) — GitHub (SAP), fetched 2026-09-25
- SAP Help Portal — Generative AI hub orchestration service overview (accessed 2026-09)
- SAP Help Portal — Generative AI hub overview (accessed 2026-09)
- SAP Help Portal — Prompt Registry (accessed 2026-09)
- SAP Developers — Tutorial: Prompt Registry Git-based sync (accessed 2026-09)
- SAP Architecture Center — AI golden path: classic ML, HANA PAL/APL vs. SAP AI Core (accessed 2026-09)
- SAP Help Portal — SAP HANA Cloud Predictive Analysis Library (PAL) documentation (accessed 2026-09)
- Python Machine Learning Client for SAP HANA (hana-ml 2.27.251222) — SAP Help Portal
- Installation Guide (hana-ml 2.27.251222) — SAP Help Portal
- hana-ml-samples: Python-API PAL notebooks — SAP on GitHub
- hana-ml Tutorial: Auto ML (PAL) notebook — SAP on GitHub
- hana_ml.algorithms.apl package (hana-ml 2.27.251222) — SAP Help Portal
- PyPI — hana-ai, Generative AI Toolkit for SAP HANA Cloud (1.1.26110100, Nov 2026)
Full card with the Consultant plan — €19.90/month. What the full card adds: the full decision framework · the SAP vs Snowflake / Databricks / Fabric comparison · the common pitfalls and their fix · the cheat sheet · the architecture schemas · the code blocks · the facts worth quoting.
Open missions
102 live roles and contracts in SAP AI & Joule right now — see the SAP AI & Joule missions · freelance SAP contracts.