ScopeDB SDK for Rust
Query ScopeDB and write rows from async Rust applications.
Upgrading an existing application? See Upgrade from 0.3 to 0.4, including the move from Ingest to Append.
Install
Requires Rust 1.91.0 or later and Tokio.
Run a query
Set SCOPEDB_ENDPOINT and SCOPEDB_API_KEY using the connection guide. Save this as src/main.rs and run cargo run:
use Error;
use Client;
async
query() waits for the result. into_objects() returns rows keyed by column name.
Write rows
With an existing events table containing id int and name string columns:
# async
send() queues a row; shutdown() waits for pending writes and closes the stream. Use flush() to wait while keeping it open. If you already have NDJSON, use Table::append.
Find what you need
| Task | API reference |
|---|---|
| Read query results | ResultSet |
| Track or cancel a query | StatementHandle |
| Read or change table schemas | Catalog |
| Tune batching and retries | AppendStreamBuilder |
| Write logs or telemetry | Continue after a batch fails |
| Set timeouts or HTTP options | ClientBuilder |
| Inspect a failure | Error |
For complete programs, see the examples. For ScopeQL syntax, see the query guide.