hana-ml Hands-On — DataFrame, ConnectionContext and ModelStorage in SAP HANA Cloud
As of 2026-09-25
Hands-on module on hana-ml, the Python Machine Learning Client for SAP HANA that M338 (PAL) and M339 (APL) already used without examining. Covers DataFrame as a lazily-executed SQL statement (not a local data copy), ConnectionContext's full surface (schema/table administration, metadata discovery, vector functions), production-grade connection practice with hdbuserstore, and ModelStorage in depth: name/version identification, the four if_exists save behaviours, the full model lifecycle (list, load, export/import, delete), persistent-memory vs HANA Data Lake storage, server-side scheduling with set_schedule(), and the model card/report as an audit trail. Three exercises cover saving and versioning a model, verifying lazy execution, and choosing between ModelStorage scheduling and the ISLM path M341 covers.
What you will learn
- Explain that a hana-ml DataFrame builds SQL rather than copying data, and name which methods trigger client-side data movement (collect, head, tail) versus which stay server-side
- Connect to SAP HANA Cloud with ConnectionContext and name at least four things it does beyond opening a connection (schema/table administration, metadata discovery, vector functions)
- Save, list, reload and delete a model with ModelStorage, explaining the four if_exists behaviours and the name/version identification scheme
- Use ModelStorage's persistent-memory and HDL storage options to match a model's storage regime to how often it is actually scored
- Schedule model retraining with ModelStorage.set_schedule() and explain when this is preferable to the ISLM path covered in M341
- Treat get_model_card(), display_model_report() and the visualizers package as audit-grade deliverables rather than optional notebook output
Module overview
Who this is for. You have worked through M338 (PAL) and M339 (APL) and have already called both from Python without stopping to look at the client itself. This module is that pause: hana-ml, the Python Machine Learning Client for SAP HANA, examined as infrastructure in its own right — how its DataFrame keeps computation inside HANA, how ConnectionContext actually connects, and how ModelStorage turns a fitted model into something a colleague can reload, version and schedule six months later. M341 then shows how a model saved this way is packaged for S/4HANA through Intelligent Scenario Lifecycle Management (ISLM). Work through this module with a HANA Cloud instance if you can reach one; every exercise also has a paper-only path.
Prerequisites
- M338 (SAP HANA PAL Hands-On) and M339 (SAP HANA APL Hands-On), or equivalent experience calling both from hana-ml
- Comfort reading Python and basic SQL
- Optional for the hands-on variants of E1-E3: access to a SAP HANA Cloud trial or client sandbox, and the hana-ml package installed
Outcomes
- Explain to a client, correctly, why hana-ml keeps computation inside HANA and exactly which calls bring data back to the client.
- Set up a governed model-storage pattern (naming, versioning, if_exists policy) a team can operate without the original author.
- Decide between persistent memory, default storage and HANA Data Lake for a model based on its actual scoring frequency.
- Choose between ModelStorage scheduling and ISLM for a given retraining scenario, with the reason written down.
Full module available to members. The full module adds: the decision framework · the end-to-end scenario walkthrough · the KPI scorecard · the anti-patterns · the code blocks · the knowledge check · the diagrams.