1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//! An async [Trino](https://trino.io/) client.
//!
//! Build a [`Client`] with [`ClientBuilder`],
//! then run queries. Rows deserialize into a `#[derive(Trino)]` struct for
//! statically-known schemas, or into [`Row`] when the shape is only known at
//! runtime.
//!
//! # Quickstart
//!
//! ```no_run
//! use trino_rust_client::{client::ClientBuilder, Trino};
//! use futures::StreamExt;
//! use serde::{Deserialize, Serialize};
//!
//! // A result row type needs `Trino` (column mapping) plus serde's derives.
//! #[derive(Trino, Debug, Deserialize, Serialize)]
//! struct Nation {
//! nationkey: i64,
//! name: String,
//! }
//!
//! # async fn run() -> Result<(), Box<dyn std::error::Error>> {
//! let client = ClientBuilder::new("user", "localhost")
//! .port(8080)
//! .catalog("tpch")
//! .schema("sf1")
//! .build()?;
//!
//! // Buffer the whole result set:
//! let nations = client.get_all::<Nation>("SELECT nationkey, name FROM nation").await?;
//! for n in nations.as_slice() {
//! println!("{n:?}");
//! }
//!
//! // β¦or stream it lazily, without holding the whole result in memory:
//! let mut rows = client.stream::<Nation>("SELECT nationkey, name FROM nation").await?;
//! while let Some(row) = rows.next().await {
//! println!("{:?}", row?);
//! }
//! # Ok(())
//! # }
//! ```
//!
//! # Result types
//!
//! - `#[derive(Trino)]` structs β decode columns by name into typed fields.
//! - [`Row`] β a dynamically-typed row when the schema is not known at compile
//! time; pair it with [`DataSet`] to keep the column metadata.
//!
//! # Error handling
//!
//! All fallible calls return [`error::Error`]. A query failure from the
//! coordinator is [`error::Error::Query`]; match on
//! [`QueryError::kind`](models::QueryError::kind) for common cases such as
//! `TableNotFound`. See the [`error`] module for details.
//!
//! # Cargo features
//!
//! - `spooling` β support Trino's spooling protocol for large result sets
//! (segments fetched from object storage), enabling
//! [`ClientBuilder::spooling_encoding`](client::ClientBuilder::spooling_encoding)
//! and related options.
//!
//! # Observability
//!
//! The client emits [`tracing`](https://docs.rs/tracing) events and wraps each
//! query in a span carrying its `query_id`. Install any `tracing` subscriber to
//! see them.
//!
//! Upgrading across a breaking release? See the [migration guide][mg].
//!
//! [mg]: https://github.com/nudibranches-tech/trino-rust-client/blob/main/MIGRATION.md
pub use *;
pub use *;
pub use *;
pub use *;