3 stable releases
3.0.0 | Jul 23, 2025 |
---|---|
2.0.0 | Apr 30, 2024 |
1.0.3 | Mar 21, 2024 |
#1766 in Web programming
39KB
711 lines
Rust Spice SDK
Rust SDK for Spice.ai
Installation
Add Spice SDK
cargo add spiceai
Usage
Usage with locally running spice runtime
Follow the quickstart guide to install and run spice locally
use spiceai::ClientBuilder;
#[tokio::main]
async fn main() {
let client = ClientBuilder::new()
.flight_url("http://localhost:50051")
.build()
.await
.unwrap();
let data = client.query("SELECT trip_distance, total_amount FROM taxi_trips ORDER BY trip_distance DESC LIMIT 10;").await;
}
New client with https://spice.ai cloud
use spiceai::ClientBuilder;
#[tokio::main]
async fn main() {
let client = ClientBuilder::new()
.api_key("API_KEY")
.use_spiceai_cloud()
.build()
.await
.unwrap();
}
Arrow Query
SQL Query
use spiceai::ClientBuilder;
#[tokio::main]
async fn main() {
let client = ClientBuilder::new()
.api_key("API_KEY")
.use_spiceai_cloud()
.build()
.await
.unwrap();
let data = client.query("SELECT * FROM taxi_trips LIMIT 10;").await;
}
Documentation
Check out our Documentation to learn more about how to use the Rust SDK.
Dependencies
~32–64MB
~1M SLoC