Skip to main content

Crate datapress_client

Crate datapress_client 

Source
Expand description

§datapress-client

Async + blocking Rust client for a running DataPress dataset server.

It wraps the JSON and Arrow IPC HTTP endpoints so you don’t have to hand-roll request bodies and response decoding. The crate is deliberately lightweight: only reqwest + serde by default, with Arrow IPC decoding behind the (default-on) arrow feature and a synchronous client behind the blocking feature.

§Async

use datapress_client::{Client, QueryRequest, Predicate};

let client = Client::new("http://127.0.0.1:8000")?;
let names = client.datasets().await?;

let req = QueryRequest::builder()
    .columns(["State", "Severity"])
    .predicate(Predicate::new("Severity", "gte", 3))
    .page_size(10_000)
    .build();
let resp = client.query_json("accidents", &req).await?;
println!("{} rows", resp.data.len());

§Blocking (feature blocking)

use datapress_client::blocking::Client;

let client = Client::new("http://127.0.0.1:8000")?;
let count = client.count("accidents", &[])?;
println!("{count} rows");

Modules§

blocking
Synchronous, blocking wrapper around the async crate::Client.

Structs§

Aggregation
One aggregation in a group_by query.
Client
Asynchronous client for a running DataPress server.
ClientBuilder
Builder for Client.
OrderBy
One ORDER BY entry. dir is "asc" (default) or "desc".
Predicate
A single filter predicate.
QueryRequest
A structured query, sent as the body of POST /datasets/{name}/query.
QueryRequestBuilder
Fluent builder for QueryRequest.
QueryResponse
JSON envelope returned by POST /datasets/{name}/query.
SqlRequest
Raw-SQL request body (POST /sql).
SqlResponse
JSON envelope returned by POST /sql.

Enums§

ClientError
Everything that can go wrong talking to a DataPress server.

Functions§

decode_ipc_stream
Decode an Arrow IPC stream into its record batches.

Type Aliases§

Result
Result alias used throughout the crate.