graphar-flight 0.1.2

Apache Arrow Flight SQL service over FalkorDB — Cypher in, Arrow out
Documentation
//! Export a Cypher query's results **into an Iceberg table** via skade.
//!
//! ```bash
//! cargo run -p graphar-flight --features skade --example export-iceberg -- \
//!   redis://127.0.0.1:6379 mygraph \
//!   "MATCH (n:Person) RETURN n._gar_id AS id, n.name AS name" \
//!   /tmp/knut_warehouse people
//! ```
//! Creates `<warehouse>/catalog.redb` + a `warehouse/` data tree and appends
//! the rows to the named Iceberg table (creating it on first write).

use graphar_flight::{FalkorExecutor, export::export_cypher_to_iceberg};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut args = std::env::args().skip(1);
    let url = args
        .next()
        .unwrap_or_else(|| "redis://127.0.0.1:6379".into());
    let graph = args.next().unwrap_or_else(|| "demo".into());
    let cypher = args
        .next()
        .unwrap_or_else(|| "MATCH (n) RETURN n._gar_id AS id LIMIT 100".into());
    let warehouse = args.next().unwrap_or_else(|| "/tmp/knut_warehouse".into());
    let table = args.next().unwrap_or_else(|| "export".into());

    let mut exec = FalkorExecutor::connect(&url, &graph).await?;
    let report = export_cypher_to_iceberg(&mut exec, &cypher, &warehouse, &table).await?;
    println!(
        "exported {} rows × {} cols → iceberg table '{table}' in {warehouse}",
        report.rows, report.columns
    );
    Ok(())
}