hdbconnect-arrow
Apache Arrow integration for the hdbconnect SAP HANA driver, enabling zero-copy data transfer to analytics tools like Polars and pandas.
Installation
Add to your Cargo.toml:
[]
= "0.1"
Or with cargo-add:
[!IMPORTANT] Requires Rust 1.85 or later.
Usage
Basic batch processing
use ;
use ;
use Arc;
Schema mapping
use ;
use TypeId;
// Convert individual types
let arrow_type = hana_type_to_arrow;
// Returns: DataType::Decimal128(18, 2)
// Convert entire field metadata
let arrow_field = hana_field_to_arrow;
Custom batch size
use BatchConfig;
let config = builder
.batch_size
.build;
Features
Enable optional features in Cargo.toml:
[]
= { = "0.1", = ["async"] }
| Feature | Description | Default |
|---|---|---|
async |
Async support via hdbconnect_async |
No |
Type mapping
| HANA Type | Arrow Type | Notes |
|---|---|---|
| TINYINT | UInt8 | Unsigned in HANA |
| SMALLINT | Int16 | |
| INT | Int32 | |
| BIGINT | Int64 | |
| REAL | Float32 | |
| DOUBLE | Float64 | |
| DECIMAL(p,s) | Decimal128(p,s) | Full precision preserved |
| CHAR, VARCHAR | Utf8 | |
| NCHAR, NVARCHAR | Utf8 | Unicode strings |
| CLOB, NCLOB | LargeUtf8 | Large text |
| BLOB | LargeBinary | Large binary |
| DATE | Date32 | Days since epoch |
| TIME | Time64(Nanosecond) | |
| TIMESTAMP | Timestamp(Nanosecond) | |
| BOOLEAN | Boolean | |
| GEOMETRY, POINT | Binary | WKB format |
API overview
Core types
HanaBatchProcessor- Converts HANA rows to ArrowRecordBatchwith configurable batch sizesBatchConfig- Configuration for batch processing (size, memory limits)SchemaMapper- Maps HANA result set metadata to Arrow schemasBuilderFactory- Creates appropriate Arrow array builders for HANA types
Traits
HanaCompatibleBuilder- Trait for Arrow builders that accept HANA valuesFromHanaValue- Sealed trait for type-safe value conversionBatchProcessor- Core batch processing interfaceLendingBatchIterator- GAT-based streaming iterator for large result sets
Error handling
use ;
Part of pyhdb-rs
This crate is part of the pyhdb-rs workspace, providing the Arrow integration layer for the Python SAP HANA driver.
Related crates:
hdbconnect-py- PyO3 bindings exposing Arrow data to Python
MSRV policy
[!NOTE] Minimum Supported Rust Version: 1.85. MSRV increases are minor version bumps.
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.