Skip to main content

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

Project description

pyhdb-rs

PyPI Python Downloads 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[polars]    # Polars integration
pip install pyhdb_rs[pandas]    # pandas + PyArrow
pip install pyhdb_rs[async]     # Async support
pip install pyhdb_rs[all]       # All integrations

[!TIP] Use uv pip install pyhdb_rs for faster installation.

Quick start

from pyhdb_rs import connect

with connect("hdbsql://USER:PASSWORD@HOST:39017") as conn:
    cursor = conn.cursor()
    cursor.execute("SELECT * FROM MY_TABLE")
    for row in cursor:
        print(row)

Usage

Polars integration

import pyhdb_rs.polars as hdb

df = hdb.read_hana(
    "SELECT * FROM sales WHERE year = 2024",
    "hdbsql://USER:PASSWORD@HOST:39017"
)
print(df.head())

pandas integration

import pyhdb_rs.pandas as hdb

df = hdb.read_hana(
    "SELECT * FROM sales",
    "hdbsql://USER:PASSWORD@HOST:39017"
)

Async support

from pyhdb_rs.aio import connect

async with await connect("hdbsql://USER:PASSWORD@HOST:39017") as conn:
    df = await conn.execute_polars("SELECT * FROM sales")
    print(df)

[!NOTE] Use async with for proper resource cleanup. The context manager handles connection pooling automatically.

Connection pooling

from pyhdb_rs.aio import create_pool

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

async with pool.acquire() as conn:
    df = await conn.execute_polars("SELECT * FROM sales")

Error handling

from pyhdb_rs import connect, DatabaseError, InterfaceError

try:
    with connect("hdbsql://USER:PASSWORD@HOST:39017") as conn:
        cursor = conn.cursor()
        cursor.execute("SELECT * FROM nonexistent")
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 connect, Connection, Cursor

def query_data(uri: str) -> list[tuple[int, str]]:
    with connect(uri) as conn:
        cursor: Cursor = conn.cursor()
        cursor.execute("SELECT id, name FROM users")
        return cursor.fetchall()

Requirements

  • Python >= 3.11

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyhdb_rs-0.1.1.tar.gz (101.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyhdb_rs-0.1.1-cp311-abi3-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.11+Windows x86-64

pyhdb_rs-0.1.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64

pyhdb_rs-0.1.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.3 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

pyhdb_rs-0.1.1-cp311-abi3-macosx_11_0_arm64.whl (3.1 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

pyhdb_rs-0.1.1-cp311-abi3-macosx_10_12_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

Details for the file pyhdb_rs-0.1.1.tar.gz.

File metadata

  • Download URL: pyhdb_rs-0.1.1.tar.gz
  • Upload date:
  • Size: 101.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyhdb_rs-0.1.1.tar.gz
Algorithm Hash digest
SHA256 50a64eb9da424d87fcd41bf591d7442bc4464febd77e225404b5a724fbb00ff9
MD5 c64d8d2ce58c43b38c1278d53a6fa26a
BLAKE2b-256 3cf3bdc7477f84e8999d59dfc5667a356e047aaedda04983cf21eb50e612ea0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.1.1.tar.gz:

Publisher: release.yml on bug-ops/pyhdb-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyhdb_rs-0.1.1-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: pyhdb_rs-0.1.1-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.5 MB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyhdb_rs-0.1.1-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 eb7708a95e4c7dd206a6c3bc10bf8a3bedf194d236da282126ec6a67b60c5a9f
MD5 973f59be1eb0afbe1b59ce1232f2202b
BLAKE2b-256 04067c964dee23551321570c2748c24953d3044fc30caf1db1ec7ce4b84e98b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.1.1-cp311-abi3-win_amd64.whl:

Publisher: release.yml on bug-ops/pyhdb-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyhdb_rs-0.1.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyhdb_rs-0.1.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bb55bd4be481bc98db791d90ca3d3b90f0e871cccc8051e3e549aeba19d34e0f
MD5 887672e2eb0ed5c5c14387ab5f3ccea8
BLAKE2b-256 1191e3aed1161955a0322e64be7339a8a653dd08b79d969af76fac249e9b1694

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.1.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on bug-ops/pyhdb-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyhdb_rs-0.1.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyhdb_rs-0.1.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a7d5df1ae09e69bad57d414bc624f58e5533d79bdf505e33e05b9dd3b8aa24ad
MD5 ac622328a6eb08a5c581a7b7f985b7d7
BLAKE2b-256 7e8ac59c3f8575fb344ff3b7c17056a8137f325646b4390ed3fb9e0951512fcb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.1.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on bug-ops/pyhdb-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyhdb_rs-0.1.1-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyhdb_rs-0.1.1-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 deadf6b4eeac3d0cf374752d12f95494c5d4704bbdb2e3edd49802eba02d47a2
MD5 260e74afbb4a51aae94b840f411a7ddd
BLAKE2b-256 9774d6e0898680a85733935a027c84c4d8c7bd523d5c262813c4c19c1be2dbd0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.1.1-cp311-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on bug-ops/pyhdb-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyhdb_rs-0.1.1-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pyhdb_rs-0.1.1-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9f8a4fbe92b8189917a1090460306a1157ab6a12915876447c8f8044cf93d744
MD5 554333809ce8736d26fe6dc3828aebda
BLAKE2b-256 44adbdb0787118d5b3c5086a1568a8c24ad54b23908028d577a8c1532f8148cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.1.1-cp311-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on bug-ops/pyhdb-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page