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.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.

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.2.4.tar.gz (113.0 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.2.4-pp311-pypy311_pp73-musllinux_1_2_x86_64.whl (2.9 MB view details)

Uploaded PyPymusllinux: musl 1.2+ x86-64

pyhdb_rs-0.2.4-pp311-pypy311_pp73-musllinux_1_2_aarch64.whl (2.7 MB view details)

Uploaded PyPymusllinux: musl 1.2+ ARM64

pyhdb_rs-0.2.4-cp314-cp314t-musllinux_1_2_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ x86-64

pyhdb_rs-0.2.4-cp314-cp314t-musllinux_1_2_aarch64.whl (2.7 MB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ ARM64

pyhdb_rs-0.2.4-cp313-cp313t-musllinux_1_2_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.13tmusllinux: musl 1.2+ x86-64

pyhdb_rs-0.2.4-cp313-cp313t-musllinux_1_2_aarch64.whl (2.7 MB view details)

Uploaded CPython 3.13tmusllinux: musl 1.2+ ARM64

pyhdb_rs-0.2.4-cp312-abi3-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.12+Windows x86-64

pyhdb_rs-0.2.4-cp312-abi3-musllinux_1_2_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.12+musllinux: musl 1.2+ x86-64

pyhdb_rs-0.2.4-cp312-abi3-musllinux_1_2_aarch64.whl (2.7 MB view details)

Uploaded CPython 3.12+musllinux: musl 1.2+ ARM64

pyhdb_rs-0.2.4-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.7 MB view details)

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

pyhdb_rs-0.2.4-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.5 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ ARM64

pyhdb_rs-0.2.4-cp312-abi3-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

pyhdb_rs-0.2.4-cp312-abi3-macosx_10_12_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.12+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: pyhdb_rs-0.2.4.tar.gz
  • Upload date:
  • Size: 113.0 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.2.4.tar.gz
Algorithm Hash digest
SHA256 5df0ab4fd723a53d0840ba01584414bf9091c33f3ae191d4800f51886bcc950a
MD5 ab6d67ffc58a2fc8a656b1368c8bae41
BLAKE2b-256 366ca5a38cb468861a03d0092f4f1fae106e42a95e4ecf1de1021563a72a768a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.2.4.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.2.4-pp311-pypy311_pp73-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pyhdb_rs-0.2.4-pp311-pypy311_pp73-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b8423506d4589aff33a9c2a0e5e3ad8cfe4ae786f9149aa53489709a33ef73ad
MD5 8d34d01259a108195f137157fe7f8d75
BLAKE2b-256 4e47d0d6fb53ed539b7ab1856e9611e7cec2ca2c850c4b8f12c0d432cf775f49

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.2.4-pp311-pypy311_pp73-musllinux_1_2_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.2.4-pp311-pypy311_pp73-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pyhdb_rs-0.2.4-pp311-pypy311_pp73-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 54416f5cf05b73cd01a00686402d7779743bfffc297ae9b5a864e86b84065293
MD5 d1bcd98e3dbb6099a53c5c11f398c33e
BLAKE2b-256 bf047d35c71358562a0715559f76d0e4464f92f9d495f6bcaa896439844c46d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.2.4-pp311-pypy311_pp73-musllinux_1_2_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.2.4-cp314-cp314t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pyhdb_rs-0.2.4-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 dcbbe82b2bed691c65bdd2832f78972930f331116842a07d9e1197c79627ee68
MD5 9f54f20167bca909df6bfcea12a1316d
BLAKE2b-256 d82c0a07e41bbb975b0d90b4da5f508e586954a936dd967420d7cfecd2c4b4ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.2.4-cp314-cp314t-musllinux_1_2_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.2.4-cp314-cp314t-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pyhdb_rs-0.2.4-cp314-cp314t-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 8bd7fc3190a8a15583305274bd1fcbffb009dd66c78d0c82f2e8fbefc55d72b4
MD5 ee3c0dd4f40dc6b0ba250aec1211cf4e
BLAKE2b-256 bf9531cada8a89a15ac6215abca7bb5458e39c6dcd2d25466823c56285ec23a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.2.4-cp314-cp314t-musllinux_1_2_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.2.4-cp313-cp313t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pyhdb_rs-0.2.4-cp313-cp313t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 fe4be62228f46598503648fc5e083604f42829933b5b814c31afb0814ea3788f
MD5 4c7ee11db1f842e0269846c133c52a46
BLAKE2b-256 9ea3fdfd7e4c5be866d75a810207ed745856613b34af7540098fb1209c77fefb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.2.4-cp313-cp313t-musllinux_1_2_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.2.4-cp313-cp313t-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pyhdb_rs-0.2.4-cp313-cp313t-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 22fb5bca430ebf01f9ec245e075284b148f48afdfabc64a57400962001068d98
MD5 722e8fd1660f8be429b9dd2c749fdfbd
BLAKE2b-256 7464e599984484246603de14e0da6cc2e2aa9bee12ab010e24f3ada5212cab3d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.2.4-cp313-cp313t-musllinux_1_2_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.2.4-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: pyhdb_rs-0.2.4-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.12+, 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.2.4-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 1763ef5d1849def49b92c780400e1c6952a12908440af153f1f165d526d8e5e4
MD5 7cf25389a71510899593a7c6ebd1a83c
BLAKE2b-256 dc055968e50362990292481eb540a9f74b5cc5a8d11b949368d5ed9241010795

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.2.4-cp312-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.2.4-cp312-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pyhdb_rs-0.2.4-cp312-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 94b50a1fafbe44e2c3beb437fa3c343934f5ca5ce48d928f32a85317c9f6fec4
MD5 17805eeb70ac3a39cfd24214cf39646f
BLAKE2b-256 6d6963b67a6ed017ff6799c47e35e53324e8896fc9ec39df3be786616acc9a25

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.2.4-cp312-abi3-musllinux_1_2_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.2.4-cp312-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pyhdb_rs-0.2.4-cp312-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 b970da204c4b2188856873141eced6b376b7d6a6a07790d6da50f936637f92b5
MD5 78710ac63e4f8505217278445a57aabc
BLAKE2b-256 c3dc28e48445378f762a299f5db32d3fd364eec4a1751111c227073df1317505

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.2.4-cp312-abi3-musllinux_1_2_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.2.4-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyhdb_rs-0.2.4-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 19d3a69d853716e5f9a1105d3b1ed6260a751479c5cb00be830deea4fc658676
MD5 6176b5cc5b0d969aa17ab44a12a40620
BLAKE2b-256 4cea3a25d8537eacb40316c08c03ba1070e1fa083a758d75d5456a5bdbfbc587

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.2.4-cp312-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.2.4-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyhdb_rs-0.2.4-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 91dfef2cb4e5d6240dcf4007e8d3ce342f0c3a91bafcd9207db04dbfea56be03
MD5 df8e1e8b8503d47f3f99bb95e42b1138
BLAKE2b-256 88c9350af3d85f107d5144936505fd0a82ad67f5dead0afcc2550959cb257764

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.2.4-cp312-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.2.4-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyhdb_rs-0.2.4-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3fcc1cf67a51c856a11bcb51ed60f87df9f04f629ec238c52e515b42920fd83d
MD5 ecb856be24ab632b5a26c8a04f2d05fb
BLAKE2b-256 05e4fe7eaffe0a939bc7c85c97140874246e10d2671213e59329a2146629c1be

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhdb_rs-0.2.4-cp312-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.2.4-cp312-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pyhdb_rs-0.2.4-cp312-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ad969e554c0084f6fab43763970577a42bd233c8e8c373a35c47ce18cea84e02
MD5 5e50c99d854fd4fd9ca7bfe35823cc22
BLAKE2b-256 9955b6db84257501ecad68962e1ec7a88154572f25a4b5f83277887d74823940

See more details on using hashes here.

Provenance

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