Skip to main content

hdbconnect_arrow/
lib.rs

1//! Apache Arrow integration for hdbconnect SAP HANA driver.
2//!
3//! This crate provides zero-copy conversion from HANA `ResultSets` to Apache Arrow
4//! `RecordBatches`, enabling efficient data transfer to Python via `PyO3`.
5//!
6//! # Features
7//!
8//! - Type-safe HANA to Arrow type mapping
9//! - Streaming `RecordBatch` iteration for large result sets
10//! - Sealed traits for API stability
11//! - Generic Associated Types (GATs) for lending iterators
12//!
13//! # Example
14//!
15//! ```rust,ignore
16//! use hdbconnect_arrow::{Result, BatchConfig, HanaBatchProcessor};
17//!
18//! // Configure batch processing
19//! let config = BatchConfig::default();
20//! let schema = /* Arrow schema */;
21//! let mut processor = HanaBatchProcessor::new(schema, config);
22//!
23//! // Process rows
24//! for row in result_set {
25//!     if let Some(batch) = processor.process_row(&row)? {
26//!         // Handle batch
27//!     }
28//! }
29//!
30//! // Flush remaining rows
31//! if let Some(batch) = processor.flush()? {
32//!     // Handle final batch
33//! }
34//! ```
35#![warn(missing_docs)]
36#![warn(clippy::all)]
37#![warn(clippy::pedantic)]
38
39pub mod builders;
40pub mod conversion;
41pub mod error;
42pub mod schema;
43#[cfg(test)]
44pub mod test_utils;
45pub mod traits;
46pub mod types;
47
48// Re-export main types for convenience
49pub use builders::factory::BuilderFactory;
50pub use conversion::{HanaBatchProcessor, rows_to_record_batch};
51pub use error::{ArrowConversionError, Result};
52pub use schema::mapping::SchemaMapper;
53pub use traits::builder::HanaCompatibleBuilder;
54pub use traits::row::RowLike;
55#[cfg(any(test, feature = "test-utils"))]
56pub use traits::row::{MockRow, MockRowBuilder};
57pub use traits::sealed::FromHanaValue;
58pub use traits::streaming::{BatchConfig, BatchProcessor, LendingBatchIterator};
59#[cfg(feature = "async")]
60pub use types::arrow::FieldMetadataExtAsync;
61pub use types::arrow::{FieldMetadataExt, hana_field_to_arrow, hana_type_to_arrow};
62pub use types::conversion::TypeCategory;
63pub use types::hana::{
64    Binary, Decimal, DecimalPrecision, DecimalScale, HanaTypeCategory, Lob, Numeric, Spatial,
65    StringType, Temporal, TypedColumn,
66};