Module rusqlite::vtab::csvtab

source ·
Available on crate features vtab and csvtab only.
Expand description

CSV Virtual Table.

Port of csv C extension: https://www.sqlite.org/csv.html

Example

fn example() -> Result<()> {
    // Note: This should be done once (usually when opening the DB).
    let db = Connection::open_in_memory()?;
    rusqlite::vtab::csvtab::load_module(&db)?;
    // Assume my_csv.csv
    let schema = "
        CREATE VIRTUAL TABLE my_csv_data
        USING csv(filename = 'my_csv.csv')
    ";
    db.execute_batch(schema)?;
    // Now the `my_csv_data` (virtual) table can be queried as normal...
    Ok(())
}

Functions