{"id":23837,"library":"hana-ml","title":"hana-ml","description":"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.","status":"active","version":"2.28.26042901","language":"python","source_language":"en","source_url":"https://github.com/SAP/hana-ml","tags":["SAP HANA","machine learning","in-database ML","dataframe"],"install":[{"cmd":"pip install hana-ml","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"SAP HANA database client driver for connection","package":"hdbcli","optional":false}],"imports":[{"note":"Correct import path for establishing HANA connection.","symbol":"ConnectionContext","correct":"from hana_ml.dataframe import ConnectionContext"},{"note":"Used to transfer pandas DataFrame to HANA DataFrame.","symbol":"create_dataframe_from_pandas","correct":"from hana_ml.dataframe import create_dataframe_from_pandas"}],"quickstart":{"code":"from hana_ml.dataframe import ConnectionContext\nimport os\n\n# Connect to HANA (use environment variables for credentials)\ncc = ConnectionContext(\n    address=os.environ.get('HANA_HOST', 'localhost'),\n    port=int(os.environ.get('HANA_PORT', 30015)),\n    user=os.environ.get('HANA_USER', 'USER1'),\n    password=os.environ.get('HANA_PASSWORD', 'Password123')\n)\nprint(cc.connection.isconnected())\n\n# Create a HANA DataFrame from a SQL query\nhdf = cc.sql('SELECT * FROM DUMMY')\nprint(hdf.head())","lang":"python","description":"Establishes connection to SAP HANA and runs a simple query."},"warnings":[{"fix":"Update imports to `from hana_ml.dataframe import DataFrame, ConnectionContext`.","message":"In 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.","severity":"breaking","affected_versions":"<2.20"},{"fix":"Use `pip install hana-ml`, then import as `hana_ml`.","message":"The `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.","severity":"gotcha","affected_versions":"all"},{"fix":"Use `map` or register vectorized Python UDFs via `create_udf`.","message":"The `apply` method on DataFrames for user-defined functions is deprecated in favor of `map` or vectorized UDFs.","severity":"deprecated","affected_versions":">=2.20"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `pip install hana-ml` and verify installation with `pip list | grep hana-ml`.","cause":"Python cannot find the hana_ml package. Either not installed or installed from wrong source.","error":"ModuleNotFoundError: No module named 'hana_ml'"},{"fix":"Check HANA_HOST and HANA_PORT environment variables. Ensure the HANA instance is reachable. For testing, use `telnet <host> <port>`.","cause":"Incorrect host, port, or network issues. Firewall or wrong address.","error":"DBTError: db error: [SAP AG][LIBODBCHDB DLL][HDBODBC] Communication error -10: cannot connect to host"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}