Comment on page
🆕
Rust SDK
Rust SDK for Spice.ai
It uses Apache Arrow Flight to efficiently stream data to the client and Apache Arrow Records as data frames.
Add the following to your
Cargo.toml
:[dependencies]
spice-rs = { git = "https://github.com/spiceai/spice-rs", tag = "v1.0.2" }
use spice_rs::Client;
let client = Client::new("API_KEY").await;
let flight_data_stream = client.query("SELECT * FROM eth.recent_blocks LIMIT 10;").await.expect("Error executing query");
3. Iterate through the reader to access the records.
while let Some(batch) = flight_data_stream.next().await {
match batch {
Ok(batch) => {
/* process batch */
println!("{:?}", batch)
},
Err(e) => {
/* handle error */
},
};
}
Last modified 1mo ago