Skip to main content

pyhdb-rs

PyPI Python codecov CI License

High-performance Python driver for SAP HANA with native Apache Arrow support.

Features

  • DB-API 2.0 compliant - Drop-in replacement for existing HANA drivers
  • Zero-copy Arrow integration - Direct data transfer to Polars and pandas
  • Async support - Native async/await with connection pooling
  • Type-safe - Full type hints and strict typing
  • Fast - Built with Rust for 2x+ performance over hdbcli

Installation

pip install pyhdb_rs

With optional dependencies:

pip install pyhdb_rs[async]     # Async support

For DataFrame libraries, install separately:

pip install polars              # Polars DataFrame library
pip install pandas pyarrow      # pandas with Arrow support

Tip: Use uv pip install pyhdb_rs for faster installation.

Quick start

from pyhdb_rs import ConnectionBuilder
import polars as pl

conn = ConnectionBuilder.from_url("hdbsql://USER:PASSWORD@HOST:39017").build()
reader = conn.execute_arrow("SELECT * FROM SALES_ORDERS WHERE ORDER_STATUS = 'SHIPPED'")
df = pl.from_arrow(reader)
print(df)
conn.close()

Usage

Polars integration

from pyhdb_rs import ConnectionBuilder
import polars as pl

conn = ConnectionBuilder.from_url("hdbsql://USER:PASSWORD@HOST:39017").build()
reader = conn.execute_arrow(
    """SELECT PRODUCT_NAME, SUM(QUANTITY) AS TOTAL_SOLD, SUM(NET_AMOUNT) AS REVENUE
       FROM SALES_ITEMS
       WHERE FISCAL_YEAR = 2025 AND REGION = 'EMEA'
       GROUP BY PRODUCT_NAME
       ORDER BY REVENUE DESC"""
)
df = pl.from_arrow(reader)
print(df.head())
conn.close()

pandas integration

from pyhdb_rs import ConnectionBuilder
import pyarrow as pa

conn = ConnectionBuilder.from_url("hdbsql://USER:PASSWORD@HOST:39017").build()
reader = conn.execute_arrow(
    """SELECT c.CUSTOMER_NAME, COUNT(o.ORDER_ID) AS ORDER_COUNT, SUM(o.TOTAL_AMOUNT) AS TOTAL_SPENT
       FROM CUSTOMERS c
       JOIN SALES_ORDERS o ON c.CUSTOMER_ID = o.CUSTOMER_ID
       WHERE o.ORDER_DATE >= '2025-01-01'
       GROUP BY c.CUSTOMER_NAME
       HAVING SUM(o.TOTAL_AMOUNT) > 5000"""
)
pa_reader = pa.RecordBatchReader.from_stream(reader)
df = pa_reader.read_all().to_pandas()
print(df)
conn.close()

Async support

The async API provides full async/await support with connection pooling.

import asyncio
import polars as pl
from pyhdb_rs.aio import AsyncConnectionBuilder


async def main():
    conn = await (
        AsyncConnectionBuilder().host("hana.example.com").credentials("USER", "PASSWORD").build()
    )

    async with conn:
        reader = await conn.execute_arrow(
            """SELECT PRODUCT_CATEGORY, COUNT(*) AS ITEM_COUNT, SUM(NET_AMOUNT) AS TOTAL_REVENUE
               FROM SALES_ITEMS
               WHERE ORDER_DATE >= '2025-01-01'
               GROUP BY PRODUCT_CATEGORY"""
        )
        df = pl.from_arrow(reader)
        print(df)


asyncio.run(main())

Note: Use async with for proper resource cleanup. The context manager automatically closes the connection on exit.

Connection pooling

import asyncio
import polars as pl
from pyhdb_rs.aio import create_pool

pool = create_pool("hdbsql://USER:PASSWORD@HOST:39017", max_size=10, connection_timeout=30)


async def handle_request(customer_id: int):
    async with pool.acquire() as conn:
        reader = await conn.execute_arrow(
            f"""SELECT o.ORDER_ID, o.ORDER_DATE, o.TOTAL_AMOUNT, o.ORDER_STATUS
                FROM SALES_ORDERS o
                WHERE o.CUSTOMER_ID = {customer_id} AND o.ORDER_DATE >= '2025-01-01'
                ORDER BY o.ORDER_DATE DESC"""
        )
        return pl.from_arrow(reader)


# Run concurrent queries
results = await asyncio.gather(handle_request(1001), handle_request(1002), handle_request(1003))

Error handling

from pyhdb_rs import ConnectionBuilder, DatabaseError, InterfaceError

try:
    conn = ConnectionBuilder.from_url("hdbsql://USER:PASSWORD@HOST:39017").build()
    cursor = conn.cursor()
    cursor.execute(
        "SELECT CUSTOMER_NAME, EMAIL FROM CUSTOMERS WHERE REGISTRATION_DATE >= ?", ["2025-01-01"]
    )
except DatabaseError as e:
    print(f"Database error: {e}")
except InterfaceError as e:
    print(f"Connection error: {e}")

Type hints

This package is fully typed and includes inline type stubs:

from pyhdb_rs import ConnectionBuilder, Connection, Cursor


def query_data(uri: str, status: str) -> list[tuple[int, str, str]]:
    conn = ConnectionBuilder.from_url(uri).build()
    cursor: Cursor = conn.cursor()
    cursor.execute(
        "SELECT ORDER_ID, CUSTOMER_NAME, ORDER_STATUS FROM SALES_ORDERS WHERE ORDER_STATUS = ?",
        [status],
    )
    result = cursor.fetchall()
    conn.close()
    return result

Requirements

  • Python >= 3.12

Development

git clone https://github.com/bug-ops/pyhdb-rs
cd pyhdb-rs/python

pip install -e ".[dev]"

pytest
ruff check .
mypy .

Documentation

See the main repository for full documentation.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Metadata

Release files for pyhdb-rs 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyhdb-rs 0.4.0
File Size Uploaded Provenance Actions
pyhdb_rs-0.4.0.tar.gz 187.5 kB With provenance Details for pyhdb_rs-0.4.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pyhdb-rs 0.4.0
File Actions
pyhdb_rs-0.4.0-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for pyhdb_rs-0.4.0-cp312-abi3-win_amd64.whl
pyhdb_rs-0.4.0-cp312-abi3-musllinux_1_2_x86_64.whl CPython 3.12 abi3 Linux musl 1.2+ x86-64 Details for pyhdb_rs-0.4.0-cp312-abi3-musllinux_1_2_x86_64.whl
pyhdb_rs-0.4.0-cp312-abi3-musllinux_1_2_aarch64.whl CPython 3.12 abi3 Linux musl 1.2+ ARM64 Details for pyhdb_rs-0.4.0-cp312-abi3-musllinux_1_2_aarch64.whl
pyhdb_rs-0.4.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 abi3 Linux glibc 2.17+ x86-64 Details for pyhdb_rs-0.4.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
pyhdb_rs-0.4.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 abi3 Linux glibc 2.17+ ARM64 Details for pyhdb_rs-0.4.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
pyhdb_rs-0.4.0-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details for pyhdb_rs-0.4.0-cp312-abi3-macosx_11_0_arm64.whl
pyhdb_rs-0.4.0-cp312-abi3-macosx_10_12_x86_64.whl CPython 3.12 abi3 macOS 10.12+ x86-64 Details for pyhdb_rs-0.4.0-cp312-abi3-macosx_10_12_x86_64.whl

Total release size: 24.8 MB

Release files / pyhdb_rs-0.4.0.tar.gz

Download URL pyhdb_rs-0.4.0.tar.gz
Size 187.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2f9d167b1f07a760435a0cea22793902f63d6716f2578704161b2e771ea71ed8
BLAKE2b-256 checksum
How to use checksums
fa345bbd8e1c3e8622f651bdfc0c51e2adc212dca6e9e1653ba1b52109f40967
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / pyhdb_rs-0.4.0-cp312-abi3-win_amd64.whl

Download URL pyhdb_rs-0.4.0-cp312-abi3-win_amd64.whl
Size 3.4 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
65b70adbb8d65e3c90c179d901c810c23fe09839a0a4e6951aeaa64426016465
BLAKE2b-256 checksum
How to use checksums
56929a3f319e83c7dac79b65cc7a0edfc9255497664ade2d09eb350f315a274d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / pyhdb_rs-0.4.0-cp312-abi3-musllinux_1_2_x86_64.whl

Download URL pyhdb_rs-0.4.0-cp312-abi3-musllinux_1_2_x86_64.whl
Size 3.9 MB
Tags CPython 3.12 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
265884c51cabb0c75788ffeeb37d1a8045cda4deaa1c7aec505e1e94341c3be4
BLAKE2b-256 checksum
How to use checksums
745b17e055b9ab1c664136db0b24fb28d4ba6b2c48f207e5178de758c51aa433
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / pyhdb_rs-0.4.0-cp312-abi3-musllinux_1_2_aarch64.whl

Download URL pyhdb_rs-0.4.0-cp312-abi3-musllinux_1_2_aarch64.whl
Size 3.7 MB
Tags CPython 3.12 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
0b0f69da4383690b7f9480fa2d8d9448469c583c5155116b06d0b4eaa18ddc69
BLAKE2b-256 checksum
How to use checksums
7fa296cf21db40e96e6b85001809c5ef489d6d4734d38bc590efc3aaaae6a8e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / pyhdb_rs-0.4.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pyhdb_rs-0.4.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 3.7 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
572e1ff7d9ce3dc9c27ef57119d5eb0211c4bdc6b37926ac35b1ebdb62ea118e
BLAKE2b-256 checksum
How to use checksums
7ee77d234f110e7f8ce0ff415648e000329002d510223e4abf0e3117c059cdf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / pyhdb_rs-0.4.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL pyhdb_rs-0.4.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 3.5 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
6635027604f146b380f93eaf0a7d391217d2a0b1d9c17f177d7e95004d5c99b0
BLAKE2b-256 checksum
How to use checksums
38ec273cbe88796e6750de18788d24b9133fa1e99cc9b1ff9f54ba2036822155
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / pyhdb_rs-0.4.0-cp312-abi3-macosx_11_0_arm64.whl

Download URL pyhdb_rs-0.4.0-cp312-abi3-macosx_11_0_arm64.whl
Size 3.1 MB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6b20cad5d0d7224dea4bb1d1dc698040a53a35adbad363f3ae63fe14a4023ef0
BLAKE2b-256 checksum
How to use checksums
a3e1229eca0dbc2a0eefa85359e8eedf58d9faecaa575e28be4184427cfaa9f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / pyhdb_rs-0.4.0-cp312-abi3-macosx_10_12_x86_64.whl

Download URL pyhdb_rs-0.4.0-cp312-abi3-macosx_10_12_x86_64.whl
Size 3.4 MB
Tags CPython 3.12 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
f61a07caf23e97e55ab13f6ad07895107308ba35ca087a56346d0de22b94f0ed
BLAKE2b-256 checksum
How to use checksums
f6680a00f368d1b95c6c25b045dedc308bd879e5ac1f0f8f2657033333f75e89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Security for pyhdb-rs 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 8 files in this release have been uploaded with provenance metadata.

Select from 8 files

Attestation for pyhdb_rs-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page