skillfed

sqlalchemy-hana

SQLAlchemy dialect for SAP HANA

sqlalchemy-hana v4.6.1 690.3K downloads/30d#5,329 on PyPI149
Permissive license Apache-2.0 Active released

What it is and what it does

sqlalchemy-hana is a SQLAlchemy dialect that bridges Python applications to SAP HANA databases. It translates SQLAlchemy's ORM queries and SQL expressions into HANA-compatible SQL, using hdbcli as the underlying connection driver. The dialect handles HANA-specific quirks like case sensitivity rules, LIMIT/OFFSET behavior, and type mappings (e.g., String→NVARCHAR, JSON→NCLOB).

The package supports core HANA features including table type specification (ROW or COLUMN), foreign key constraints, unique constraints, and schema reflection via a custom HANAInspector. It works with SAP HANA Cloud, on-premise HANA, and HANA Express Edition. The dialect is production-stable, actively maintained, and covers modern Python versions (3.10–3.14). Note that RETURNING clauses and ARRAY types are not supported, and some type features like JSON deep indexing are limited by HANA itself.

Use it for:

  • Build a Python web application using SQLAlchemy ORM against an existing SAP HANA database without writing raw SQL.
  • Migrate a SQLAlchemy application from another database to SAP HANA by switching the connection string.
  • Reflect an existing HANA schema into SQLAlchemy models for rapid prototyping or data exploration.
  • Use HANA-specific table types (ROW or COLUMN) and UUID storage options (VARBINARY or NVARCHAR) via sqlalchemy-hana's extended API.
  • Connect to SAP HANA Cloud or Express Edition from a Python data pipeline or ETL workflow.

Worth the install?

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

Provides a SQLAlchemy dialect that enables you to use SAP HANA as a database backend, translating SQLAlchemy ORM and SQL expressions into HANA-compatible SQL via the hdbcli driver.

Yes. The package is production-stable, actively maintained, has no known vulnerabilities, and carries a permissive license. Install friction is low. It is the standard way to use SAP HANA from SQLAlchemy in Python. Suitable for enterprise applications, data pipelines, and applications requiring HANA-specific features. Verify that hdbcli is available in your environment and that your Python version is 3.10 or later.

Install

sqlalchemy-hana on PyPI

pip

pip install sqlalchemy-hana

uv

uv add sqlalchemy-hana

poetry

poetry add sqlalchemy-hana

Installing sqlalchemy-hana

Before you install

Low friction install with a pure-Python wheel. Actively maintained—last release 28 days ago, repository shows recent activity. Requires Python 3.10+ and SQLAlchemy 2.x, plus the hdbcli driver which must be separately installed or available.

License in practice

Apache-2.0 permissive license allows commercial and private use with minimal restrictions, making it suitable for most enterprise and open-source projects.

Quickstart

pip install sqlalchemy-hana

from sqlalchemy import create_engine
engine = create_engine('hana://username:password@example.de:30015')

Requires Python 3.10+, SQLAlchemy 2.x, and the hdbcli driver to be installed separately or available in your environment.

Verify before relying

  • Whether hdbcli is automatically installed as a dependency or must be managed separately by the user.
  • Performance characteristics and query optimization support compared to other HANA connectors.
  • Completeness of reflection and introspection features for complex HANA schemas.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (~=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 3 — sqlalchemy, hdbcli, typing_extensions
Maintenance actively maintained — 28 days since the last release
Last repo commit
First released
Downloads 690,302/month — #5,329 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: sqlalchemy_hana-4.6.1-py3-none-any.whl

Keywords: sqlalchemy, sap, hana

Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: SQLTopic :: DatabaseTopic :: Database :: Front-EndsTopic :: Software DevelopmentTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Tags

sqlalchemy sap hana dialecthana database driver pythonsqlalchemy hana connectorsap hana orm supporthdbcli sqlalchemy integrationhana database adapterpython sap hana sql
sap-hanadatabase-driverorm-dialect

More Software Development packages