{"id":37377722,"url":"https://github.com/bug-ops/pyhdb-rs","last_synced_at":"2026-04-26T01:06:09.996Z","repository":{"id":331763018,"uuid":"1131924829","full_name":"bug-ops/pyhdb-rs","owner":"bug-ops","description":"Rust-powered SAP HANA driver for Python with native Apache Arrow support. Zero-copy data transfer to Polars \u0026 Pandas. DB-API 2.0, async/await, connection pooling","archived":false,"fork":false,"pushed_at":"2026-01-13T04:29:20.000Z","size":343,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-16T15:52:05.130Z","etag":null,"topics":["arrow","async","database","dbapi","driver","hana","pandas","performance","polars","pyo3","python","rust","sap","sap-hana","zero-copy"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bug-ops.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-11T00:44:03.000Z","updated_at":"2026-01-13T04:28:35.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/bug-ops/pyhdb-rs","commit_stats":null,"previous_names":["bug-ops/pyhdb-rs"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/bug-ops/pyhdb-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bug-ops%2Fpyhdb-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bug-ops%2Fpyhdb-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bug-ops%2Fpyhdb-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bug-ops%2Fpyhdb-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bug-ops","download_url":"https://codeload.github.com/bug-ops/pyhdb-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bug-ops%2Fpyhdb-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28530235,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arrow","async","database","dbapi","driver","hana","pandas","performance","polars","pyo3","python","rust","sap","sap-hana","zero-copy"],"created_at":"2026-01-16T05:04:16.956Z","updated_at":"2026-02-20T21:07:41.420Z","avatar_url":"https://github.com/bug-ops.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pyhdb-rs\n\n**Unlock your SAP HANA data for modern analytics and AI workflows.**\n\nPure Rust toolkit — no SAP client installation required. Connect to HANA from anywhere, stream data directly into Polars, pandas, or DuckDB via Apache Arrow. Let AI assistants explore your schemas through a secure MCP interface.\n\n[![CI](https://github.com/bug-ops/pyhdb-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/bug-ops/pyhdb-rs/actions/workflows/ci.yml)\n[![Security](https://github.com/bug-ops/pyhdb-rs/actions/workflows/security.yml/badge.svg)](https://github.com/bug-ops/pyhdb-rs/actions/workflows/security.yml)\n[![codecov](https://codecov.io/gh/bug-ops/pyhdb-rs/graph/badge.svg?token=75RR61N6FI)](https://codecov.io/gh/bug-ops/pyhdb-rs)\n[![CodSpeed](https://img.shields.io/endpoint?url=https://codspeed.io/badge.json)](https://codspeed.io/bug-ops/pyhdb-rs)\n[![PyPI](https://img.shields.io/pypi/v/pyhdb_rs.svg)](https://pypi.org/project/pyhdb_rs/)\n[![Crates.io](https://img.shields.io/crates/v/hdbconnect-mcp.svg)](https://crates.io/crates/hdbconnect-mcp)\n[![License](https://img.shields.io/badge/license-Apache--2.0%20OR%20MIT-blue.svg)](LICENSE-APACHE)\n\n## Why pyhdb-rs?\n\n| Pain Point | Solution |\n|------------|----------|\n| SAP client installation \u0026 licensing | **Pure Rust** — no SAP dependencies, just `pip install` |\n| Memory explodes with big datasets | **Zero-copy Arrow** streams data directly to DataFrames |\n| Manual schema discovery for AI tools | **MCP server** gives Claude/Cline native HANA access |\n| Complex ETL for analytics | **One-liner** to Polars LazyFrame or pandas |\n\n## Quick Start\n\n### For Data Engineers \u0026 Scientists\n\n```bash\npip install pyhdb_rs\n```\n\n```python\nfrom pyhdb_rs import ConnectionBuilder\nimport polars as pl\n\n# Connect and extract — data flows directly to Polars without copies\nconn = ConnectionBuilder.from_url(\"hdbsql://user:pass@hana:30015\").build()\ndf = pl.from_arrow(conn.execute_arrow(\"\"\"\n    SELECT material, plant, SUM(quantity) as total\n    FROM sapabap1.mard\n    GROUP BY material, plant\n\"\"\"))\n\n# Lazy evaluation for memory-efficient analytics\nresult = df.lazy().filter(pl.col(\"total\") \u003e 1000).collect()\n```\n\n\u003e [!TIP]\n\u003e Data exports via [Apache Arrow](https://arrow.apache.org/) — the universal columnar format. Integrates with the entire Arrow ecosystem out of the box.\n\n### Arrow Ecosystem Compatibility\n\nStream HANA data directly into any Arrow-compatible tool:\n\n| Category | Tools |\n|----------|-------|\n| **DataFrames** | [Polars](https://pola.rs/), [pandas](https://pandas.pydata.org/), [Vaex](https://vaex.io/), [Dask](https://www.dask.org/) |\n| **Query Engines** | [DuckDB](https://duckdb.org/), [DataFusion](https://datafusion.apache.org/), [ClickHouse](https://clickhouse.com/) |\n| **ETL / Streaming** | [Apache Spark](https://spark.apache.org/), [Apache Flink](https://flink.apache.org/), [Kafka + Arrow](https://arrow.apache.org/) |\n| **ML / AI** | [Ray](https://www.ray.io/), [Hugging Face Datasets](https://huggingface.co/docs/datasets/), [PyTorch](https://pytorch.org/) |\n| **Data Lakes** | [Delta Lake](https://delta.io/), [Apache Iceberg](https://iceberg.apache.org/), [Lance](https://lancedb.github.io/lance/) |\n| **Serialization** | [Parquet](https://parquet.apache.org/), [Arrow IPC/Feather](https://arrow.apache.org/docs/python/ipc.html) |\n\nZero-copy data transfer means no serialization overhead between HANA and your analytics stack.\n\n### For AI-Assisted Development\n\n```bash\ncargo install hdbconnect-mcp\n```\n\nAdd to Claude Desktop config:\n\n```json\n{\n  \"mcpServers\": {\n    \"hana\": {\n      \"command\": \"hdbconnect-mcp\",\n      \"args\": [\"--url\", \"hdbsql://user:pass@hana:30015\"]\n    }\n  }\n}\n```\n\nNow ask Claude: *\"Show me the top 10 customers by revenue from VBAK/VBAP\"* — it queries HANA directly.\n\n## Components\n\n| Package | Use Case | Install |\n|---------|----------|---------|\n| [**pyhdb_rs**](python/README.md) | Python analytics, ETL pipelines, ML feature extraction | `pip install pyhdb_rs` |\n| [**hdbconnect-mcp**](crates/hdbconnect-mcp/README.md) | AI assistants, natural language queries, schema exploration | `cargo install hdbconnect-mcp` |\n| [**hdbconnect-arrow**](crates/hdbconnect-arrow/README.md) | Rust applications, custom Arrow integrations | `cargo add hdbconnect-arrow` |\n\n## Python Driver\n\nFull DB-API 2.0 compliance with native Arrow integration. No SAP client required — works anywhere Python runs.\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eAsync ETL with connection pooling\u003c/strong\u003e\u003c/summary\u003e\n\n```python\nfrom pyhdb_rs.aio import ConnectionPoolBuilder\nimport polars as pl\n\npool = ConnectionPoolBuilder().url(\"hdbsql://user:pass@hana:30015\").max_size(10).build()\n\nasync def extract_sales(region: str) -\u003e pl.DataFrame:\n    async with pool.acquire() as conn:\n        return pl.from_arrow(await conn.execute_arrow(f\"\"\"\n            SELECT vbeln, erdat, netwr FROM sapabap1.vbak\n            WHERE region = '{region}' AND erdat \u003e= '20240101'\n        \"\"\"))\n\n# Parallel extraction across regions\nresults = await asyncio.gather(*[extract_sales(r) for r in [\"US\", \"EU\", \"APAC\"]])\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003epandas integration\u003c/strong\u003e\u003c/summary\u003e\n\n```python\nimport pyarrow as pa\n\nreader = conn.execute_arrow(\"SELECT * FROM sapabap1.mara WHERE mtart = 'FERT'\")\ndf = pa.RecordBatchReader.from_stream(reader).read_all().to_pandas()\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eStreaming large datasets\u003c/strong\u003e\u003c/summary\u003e\n\n```python\nfrom pyhdb_rs import ArrowConfig\n\n# Process 100M rows with constant memory\nconfig = ArrowConfig(batch_size=50_000)\nreader = conn.execute_arrow(\"SELECT * FROM sapabap1.mseg\", config=config)\n\nfor batch in reader:\n    process_batch(batch)  # Each batch: 50K rows as Arrow RecordBatch\n```\n\n\u003c/details\u003e\n\n**Full documentation:** [Python package README](python/README.md) — TLS configuration, HA clusters, transaction control, error handling.\n\n## MCP Server for AI Agents\n\nProduction-ready server that exposes SAP HANA to Claude, Cline, Cursor, and any MCP-compatible assistant.\n\n**Why it matters:** Instead of copy-pasting schemas or writing boilerplate queries, let AI discover and query your data directly — with guardrails.\n\n**Security by design:**\n- Read-only mode blocks DML/DDL by default\n- Row limits prevent data exfiltration\n- OIDC/JWT authentication for enterprise deployments\n- Per-user cache isolation in multi-tenant setups\n\n**Available tools:**\n\n| Tool | What AI can do |\n|------|----------------|\n| `list_tables` | Explore schemas: *\"What tables exist in SAPABAP1?\"* |\n| `describe_table` | Understand structure: *\"Show me VBAK columns\"* |\n| `execute_sql` | Query data: *\"Get top customers by revenue\"* |\n| `ping` | Verify connectivity |\n\n**Full documentation:** [MCP server README](crates/hdbconnect-mcp/README.md) — HTTP transport, Kubernetes deployment, Prometheus metrics.\n\n## Architecture\n\n```mermaid\nflowchart TB\n    subgraph apps[\"Your Applications\"]\n        direction LR\n        subgraph python[\"Python Analytics\"]\n            p1[\"ETL Pipelines\"]\n            p2[\"ML Features\"]\n            p3[\"BI Dashboards\"]\n        end\n        subgraph ai[\"AI Assistants\"]\n            m1[\"Claude Desktop\"]\n            m2[\"Cline / Cursor\"]\n            m3[\"Custom Agents\"]\n        end\n    end\n\n    subgraph core[\"Rust Core\"]\n        arrow[\"hdbconnect-arrow\\nZero-copy HANA → Arrow\"]\n    end\n\n    subgraph hana[\"SAP HANA\"]\n        db[(\"BW/4HANA\\nS/4HANA\\nHANA Cloud\")]\n    end\n\n    apps --\u003e core\n    core --\u003e hana\n\n    style apps fill:#e3f2fd\n    style core fill:#fff8e1\n    style hana fill:#e8f5e9\n```\n\n## Requirements\n\n- **Python** 3.12+ (for pyhdb_rs)\n- **Rust** 1.88+ (for building from source or MCP server)\n\n## Resources\n\n| Resource | Link |\n|----------|------|\n| Python API | [python/README.md](python/README.md) |\n| MCP Server | [crates/hdbconnect-mcp/README.md](crates/hdbconnect-mcp/README.md) |\n| Arrow Integration | [crates/hdbconnect-arrow/README.md](crates/hdbconnect-arrow/README.md) |\n| Changelog | [CHANGELOG.md](CHANGELOG.md) |\n| Contributing | [CONTRIBUTING.md](CONTRIBUTING.md) |\n\n## License\n\nDual-licensed under [Apache-2.0](LICENSE-APACHE) or [MIT](LICENSE-MIT) at your option.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbug-ops%2Fpyhdb-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbug-ops%2Fpyhdb-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbug-ops%2Fpyhdb-rs/lists"}