Skip to main content

register_table

Function register_table 

Source
pub fn register_table(
    context: &SessionContext,
    name: impl Into<String>,
    table: DeltaTable,
    options: ScanOptions,
) -> Result<TableRegistration, DeltaReaderError>
Expand description

Registers one loaded Delta table in a DataFusion session.

Registration performs no scan. Existing registrations are preserved and reported through DeltaReaderError.

use datafusion::prelude::SessionContext;
use delta_arrow_reader::{
    DeltaTableBuilder,
    datafusion::{ScanOptions, register_table},
};

let context = SessionContext::new();
let table = DeltaTableBuilder::new("/tmp/example-delta-table")
    .load_table()
    .await?;
let registration = register_table(
    &context,
    "orders",
    table,
    ScanOptions::default(),
)?;
assert_eq!(registration.name, "orders");