Announcing spice-rs v3.0 π
The v3.0 release optimizes the Spice client API, adds support for robust query retry, and supports more custom metadata configurations for spice query.
What's New in v3.0.0
Immutable client API: Client::query() now takes &self instead of &mut self, user can issue multiple simultaneous queries without mutable borrowing.
Automatic query retry: Support automatic query retry on transient network or server-side error when obtaining the result stream in Client::query().
Retryable query stream: Introducing RetryableQueryStream as the returned type of Client::query(). This feature provides robust retry of network interruptions during data streaming.
When a connection is reset during streaming, the stream consumer has two options:
- Option 1: Retry Query Stream
// When stream consumer continue polling after a ConnectionReset error:
// 1. The query is automatically reissued
// 2. Data streaming restarts from the beginning
// Example flow:
Poll 1: β
Received batch1
Poll 2: β
Received batch2
Poll 3: β SpiceClientError::ConnectionReset error β Continue polling
Poll 4: β
Received batch1* (query restarted automatically)
Poll 5: β
Received batch2*
Poll 6: β
Received batch3*
...- Option 2: Stop polling
// Stream consumer can stop polling when it receives a ConnectionReset error
// The stream won't be retried
// Example flow:
Poll 1: β
Received batch1
Poll 2: β
Received batch2
Poll 3: β SpiceClientError::ConnectionReset error β Stop polling and handle errorExpanded support for query parameters: Support custom User-Agent and Cache-Control query metadata configurations.
Follow the Spice OSS quickstart to install and run the spice runtime locally, and query data using the spice-rs SDK:
use spiceai::ClientBuilder;
#[tokio::main]
async fn main() {
let client = ClientBuilder::new().build().await.unwrap();
let data = client.query(
"SELECT trip_distance, total_amount FROM taxi_trips ORDER BY trip_distance DESC LIMIT 10;"
).await;
}Contributors
Breaking Changes
Client::query()now takes&selfinstead of&mut self, and returns a retryable stream typeRetryableQueryStream
// Old:
fn query(&mut self, sql: &str) -> FlightRecordBatchStream
// New:
fn query(&self, sql: &str) -> RetryableQueryStreamWhat's Changed
- Fix a typo in README.md by @digadeesh in #42
- feat: Add spice user agent, update for clippy rules by @peasee in #44
- Adding custom User-Agent to spice-rs by @eadgbear in #48
- Prepend user-supplied user-agent by @phillipleblanc in #49
- Fix broken system tls loading and test by @Sevenannn in #52
- Support query retry, parameterized query, and cache control header by @Sevenannn in #51
- Enable all tests in CI by @Sevenannn in #55
- feat: Retryable query stream by @Sevenannn in #57
- Fix macos test by @Sevenannn in #58
- docs: Add endgame release process by @peasee in #46
Full Changelog: v2.0.0...v3.0.0