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.5.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.5.0
File Size Uploaded Provenance Actions
pyhdb_rs-0.5.0.tar.gz 189.4 kB With provenance Details for pyhdb_rs-0.5.0.tar.gz

Built distributions (wheels)

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

Total release size: 27.5 MB

Release files / pyhdb_rs-0.5.0.tar.gz

Download URL pyhdb_rs-0.5.0.tar.gz
Size 189.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d9b601ecc6dbda1919462a9a5364a3ed4a5fe7d3c887892cce848711895feba3
BLAKE2b-256 checksum
How to use checksums
ff5babcc7e4060adc494bf76c3da24d01d25bb723f35228960259e3d49d16f36
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 Nov 16, 2026.

Transparency log

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

Download URL pyhdb_rs-0.5.0-cp312-abi3-win_amd64.whl
Size 3.8 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
b3d74fa22804931a6e2014f5be49d62f1a8579958ff4700f73381fe9232af88b
BLAKE2b-256 checksum
How to use checksums
ebd2712938f2ad0f45ef04f9806bf96aeea000e8b3f243082043ec27c9054eb1
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 Nov 16, 2026.

Transparency log

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

Download URL pyhdb_rs-0.5.0-cp312-abi3-musllinux_1_2_x86_64.whl
Size 4.3 MB
Tags CPython 3.12 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
6a6d208920c6a2774f08c79889a4e53e483e806df4ca96d654e0e3a2d0b544a2
BLAKE2b-256 checksum
How to use checksums
781b865f11339b0b0177951992d84028e89236e6d4fc100b1783390d82c20cf6
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 Nov 16, 2026.

Transparency log

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

Download URL pyhdb_rs-0.5.0-cp312-abi3-musllinux_1_2_aarch64.whl
Size 4.0 MB
Tags CPython 3.12 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
2dd30577068dab63a7ae88402ddbd3fe4a8c762f1f8c04b18dc841368b24150a
BLAKE2b-256 checksum
How to use checksums
208a31cef61890b95e7a584c0f982e47606df6d7081efcee924a8a66319507ac
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 Nov 16, 2026.

Transparency log

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

Download URL pyhdb_rs-0.5.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 4.1 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
d4106f5b72a7b692a2bb82ca476d2144f16734ebbc7939cf229ebd116b6a131e
BLAKE2b-256 checksum
How to use checksums
b4a3c37f7440552da1d5cfff74aa6040d4cc93ff98883934d90275efe27413a7
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 Nov 16, 2026.

Transparency log

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

Download URL pyhdb_rs-0.5.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 3.9 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
1e980a1bbf59aafb03c6989156f97d47a32f29e81d831696d789a81c8fb51b64
BLAKE2b-256 checksum
How to use checksums
14f208efc5314b594a93f869e9d0a19a91aef7f49cc23ca8d65e91fd109236a0
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 Nov 16, 2026.

Transparency log

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

Download URL pyhdb_rs-0.5.0-cp312-abi3-macosx_11_0_arm64.whl
Size 3.4 MB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0ea2594e19b7eb7b2e15da2ac813d4254d7d1e7788ad693e0ff3cbe6d332fe48
BLAKE2b-256 checksum
How to use checksums
dca9130683151c76e18836c486ba5856582671d28c123eca6f7f3f7078d86753
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 Nov 16, 2026.

Transparency log

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

Download URL pyhdb_rs-0.5.0-cp312-abi3-macosx_10_12_x86_64.whl
Size 3.8 MB
Tags CPython 3.12 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
3a5ffa008c3cd2c6e23f4602980d67214bbb8282a9e59747795dca0ffdea1343
BLAKE2b-256 checksum
How to use checksums
49410305ec5029689306beb5a014c0ccba6c2664c5905ae689af44521de0467c
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 Nov 16, 2026.

Transparency log

Security for pyhdb-rs 0.5.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.5.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 Nov 16, 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