Skip to main content

export_cypher

Function export_cypher 

Source
pub async fn export_cypher(
    executor: &mut FalkorExecutor,
    cypher: &str,
    path: impl AsRef<Path>,
    file_type: FileType,
) -> Result<ExportReport>
Expand description

Run cypher against the executor’s graph and write the result rows as one GraphAr chunk file at path in file_type. Returns what was written.

The schema is inferred from FalkorDB’s response (auto-string mode), so any RETURN shape works without pre-registration. For very large results this writes a single chunk; chunked/streamed export is a future extension.

use graphar_flight::{FalkorExecutor, export::export_cypher};
use graphar::FileType;

let mut exec = FalkorExecutor::connect("redis://127.0.0.1:6379", "social").await?;
let report = export_cypher(
    &mut exec,
    "MATCH (n:Person) RETURN n._gar_id AS id, n.name AS name",
    "/tmp/people.parquet",
    FileType::Parquet,
).await?;
println!("exported {} rows", report.rows);