Skip to main content

exarrow_rs/
lib.rs

1//! # exarrow-rs
2//!
3//! ADBC-compatible driver for Exasol with Apache Arrow data format support.
4//!
5//! This library provides high-performance database connectivity for Exasol using
6//! the ADBC (Arrow Database Connectivity) interface. It enables efficient data transfer
7//! using the Apache Arrow columnar format, making it ideal for analytical workloads
8//! and data science applications.
9//!
10//! ## Features
11//!
12//! - **ADBC Interface**: Standard Arrow Database Connectivity driver
13//! - **Query Execution**: Execute SQL queries and retrieve results as Arrow RecordBatches
14//! - **Bulk Import**: Import data from CSV, Parquet, and Arrow RecordBatches
15//! - **Bulk Export**: Export data to CSV, Parquet, and Arrow RecordBatches
16//! - **Streaming**: Memory-efficient streaming for large datasets
17//! - **Compression**: Support for gzip, bzip2, snappy, lz4, and zstd compression
18//!
19//! ## Query Example
20//!
21//!
22//! ## CSV Import Example
23//!
24//!
25//! ## CSV Export Example
26//!
27//!
28//! ## Parquet Import/Export Example
29//!
30//!
31//! ## Arrow RecordBatch Import/Export Example
32//!
33
34// Module declarations
35pub mod adbc;
36pub mod arrow_conversion;
37pub mod connection;
38pub mod error;
39pub mod export;
40pub mod import;
41pub mod query;
42pub mod transport;
43pub mod types;
44
45// FFI module for C-compatible ADBC export (conditionally compiled)
46#[cfg(feature = "ffi")]
47pub mod adbc_ffi;
48
49// ADBC Interface Types
50/// Re-export ADBC driver and connection types.
51pub use adbc::{Connection, Database, Driver, Statement};
52
53// Arrow Conversion
54/// Re-export Arrow conversion utilities.
55pub use arrow_conversion::ArrowConverter;
56
57// Error Types
58/// Re-export error types for convenient error handling.
59pub use error::{ConnectionError, ConversionError, ExasolError, QueryError};
60
61// Type System
62/// Re-export type mapping utilities.
63pub use types::{ExasolType, TypeMapper};
64
65// Import Types
66/// CSV import options and functions.
67///
68/// The CSV import module provides functionality for importing data from CSV files,
69/// streams, iterators, and custom callbacks into Exasol tables.
70///
71/// # Example
72///
73pub use import::{
74    import_from_arrow_ipc,
75    import_from_callback,
76    import_from_file,
77    import_from_iter,
78    import_from_parquet,
79    import_from_parquet_stream,
80    import_from_record_batch,
81    import_from_record_batches,
82    import_from_stream,
83    // Arrow import
84    ArrowImportOptions,
85    ArrowToCsvWriter,
86    // CSV import
87    CsvImportOptions,
88    CsvWriterOptions,
89    DataPipeSender,
90    // Error type
91    ImportError,
92    // Parquet import
93    ParquetImportOptions,
94};
95
96// Export Types
97/// CSV export options and functions.
98///
99/// The export module provides functionality for exporting data from Exasol tables
100/// or query results to files, streams, in-memory lists, or custom callbacks.
101///
102/// # Example
103///
104pub use export::{
105    csv_to_record_batches,
106    exasol_types_to_arrow_schema,
107    export_to_arrow_ipc,
108    export_to_callback,
109    export_to_file,
110    export_to_list,
111    export_to_parquet,
112    export_to_parquet_stream,
113    export_to_parquet_via_transport,
114    export_to_record_batches,
115    export_to_stream,
116    // Arrow export
117    ArrowExportOptions,
118    // CSV export
119    CsvExportOptions,
120    CsvToArrowReader,
121    DataPipeReceiver,
122    ExportError,
123    // Parquet export
124    ParquetCompression,
125    ParquetExportOptions,
126};
127
128// Query Builder Types
129/// Query builder types for constructing IMPORT and EXPORT SQL statements.
130///
131/// These types provide a builder pattern for constructing Exasol IMPORT and EXPORT
132/// SQL statements with full control over CSV format options, compression, and
133/// encoding settings.
134///
135/// # Export Query Example
136///
137///
138/// # Import Query Example
139///
140pub use query::export::{Compression, DelimitMode, ExportQuery, ExportSource, RowSeparator};
141pub use query::import::{
142    Compression as ImportCompression, ImportQuery, RowSeparator as ImportRowSeparator, TrimMode,
143};
144
145// Query Execution Types
146pub use query::statement::{Parameter, StatementType};
147/// Query execution and result handling types.
148pub use query::{PreparedStatement, QueryMetadata, ResultSet, ResultSetIterator};
149
150// FFI Types (when ffi feature is enabled)
151/// Re-export FFI types when ffi feature is enabled.
152#[cfg(feature = "ffi")]
153pub use adbc_ffi::{FfiConnection, FfiDatabase, FfiDriver, FfiStatement};