githubEdit

rustRust SDK

Rust SDK for Spice.ai

The Rust SDKarrow-up-right spice-rs is the easiest way to query Spice.aiarrow-up-right from Rust.

It uses Apache Arrow Flightarrow-up-right to efficiently stream data to the client and Apache Arrowarrow-up-right Records as data frames.

Requirements

Installation

Add Spice SDK

cargo add spiceai

Usage

1. Create a SpiceClient by providing your API key to ClientBuilder. Get your free API key at spice.aiarrow-up-right.

use spiceai::ClientBuilder;

#[tokio::main]
async fn main() {
  let client = ClientBuilder::new()
    .api_key("API_KEY")
    .use_spiceai_cloud()
    .build()
    .await
    .unwrap();
}

2. Execute a query and get back an Apache Arrow Flight Record Batch Streamarrow-up-right.

3. Iterate through the reader to access the records.

Usage with local Spice runtime

Follow the quickstart guidearrow-up-right to install and run spice locally.

Contributing

Contribute to or file an issue with the spice-rs library at: https://github.com/spiceai/spice-rsarrow-up-right

Last updated

Was this helpful?