sqlalchemy-hana
SQLAlchemy dialect for SAP HANA
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-hanauv
uv add sqlalchemy-hanapoetry
poetry add sqlalchemy-hanaInstalling 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
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
hana-mlConnects Python to SAP HANA to build machine…
unclear · top 15,000 on PyPI
hdbcliA PEP 249-compliant Python database driver for…
unclear · top 5,000 on PyPI
duckdb-engineA SQLAlchemy driver that enables you to use…
permissive · top 5,000 on PyPI
pyhdbA pure Python client library for connecting to…
permissive · top 15,000 on PyPI
sqlalchemy-solrProvides a SQLAlchemy dialect that allows you…
permissive · top 15,000 on PyPI
databricks-sqlalchemyProvides a SQLAlchemy 2.0 dialect that bridges…
permissive · top 1,000 on PyPI
sqlalchemy-databricksProvides a SQLAlchemy dialect that connects to…
permissive · top 15,000 on PyPI
iomete-sqlalchemyProvides a SQLAlchemy dialect for connecting to…
permissive · top 15,000 on PyPI
pinotdbProvides Python DB-API and SQLAlchemy dialect…
permissive · top 1,000 on PyPI
pybigquerySQLAlchemy dialect for BigQuery that enables…
permissive · top 15,000 on PyPI