Skip to main content

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

Project description

pyhdb-rs

PyPI Python 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.2.tar.gz (108.2 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.2-cp311-abi3-win_amd64.whl (2.3 MB view details)

Uploaded CPython 3.11+Windows x86-64

pyhdb_rs-0.1.2-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.6 MB view details)

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

pyhdb_rs-0.1.2-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.4 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

pyhdb_rs-0.1.2-cp311-abi3-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

pyhdb_rs-0.1.2-cp311-abi3-macosx_10_12_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: pyhdb_rs-0.1.2.tar.gz
  • Upload date:
  • Size: 108.2 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.2.tar.gz
Algorithm Hash digest
SHA256 5ebfb6b5fe884374715339bf9bb4a3b944224aef9645712747a4dfebb7069c8e
MD5 aac316e8c68056fdf7526dc02a7dab44
BLAKE2b-256 7b25ad08fc18cab6801e9bea72a53653683e4dff7b5d9a2e5bd9860c8e862b4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.1.2.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.2-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: pyhdb_rs-0.1.2-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 2.3 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.2-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e284bc7f4c9745f9da257da1128a2ad189056328a531788be9990e636e6e468c
MD5 fbda8b0ffbabdbac73028aa0e0dc4c62
BLAKE2b-256 ac9f1944a11214055cd5b134a3231e5a57a1fea992e5bfc104598528c3fb2403

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.1.2-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.2-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyhdb_rs-0.1.2-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7200c516b90f08a237b3a89e07da98413f431cfd1639ed89fd07cb444507351a
MD5 4c0d1e611601eb873a4916fdba29fdc5
BLAKE2b-256 2ea68b4b3d038c64d2c459ccca3d623b520b9c6ab3304a885a26072e1d56bd2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.1.2-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.2-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyhdb_rs-0.1.2-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 64bd4fc8e68d584481cf50636e71fd3f9d22be8d556394911c8b50434efc7f9f
MD5 6eda31012b36ea5e6907423d802beeca
BLAKE2b-256 8c991a1a8626107219d355b422a0c17f324c71d8184091cc0e984605bd5acf92

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.1.2-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.2-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyhdb_rs-0.1.2-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e83bdfc0d17f03e3443386427b8d84a9ee4e45192abd7d5d4d2b8775b167f9a1
MD5 1f3adf452de0e3e6d936a2a9af3b6e5b
BLAKE2b-256 9aa6ec66f5213f3f2f20e20375310e390a38b0320fbb8c3aa900a0ae05636ec8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.1.2-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.2-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pyhdb_rs-0.1.2-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0490145eeee44b2076dee80ffea368ee1d159fe4c6a6248b98eac1f2df1eb2a4
MD5 b99f0c29a9c66f197cf31004c534fb4f
BLAKE2b-256 1852e1d6666a5b852e4e9e1cdfc59b469a5540a9d3c380ad368dabbe67b4142c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.1.2-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