6 releases
| 0.2.4 | Dec 6, 2024 |
|---|---|
| 0.2.3 | Dec 5, 2024 |
| 0.1.0 | Oct 21, 2024 |
#6 in #trino
284 downloads per month
170KB
3.5K
SLoC
This is an interface for working with the Trino database, written for
use by dbcrossbar and related tools.
Features
These may be selected at compile-time, using features = ["feature-name"]
in your Cargo.toml. If you don't specify any features, this library is
extremely lightweight.
values: Provides aValueenum that can represent a subset of Trino's values. This pulls in dependencies for lots of things, including geodata, decimals, JSON and UUIDs.proptest: Support for testing using theproptestcrate. This pulls inproptestand related libraries.client: A basic Trino REST client. This is mostly intended for testing, and does not currently attempt to be a production-quality client. It currently has no HTTPS or password support. This pulls in a full-fledged async HTTP stack.rustls-tls: Enable Rust-native HTTPS support with WebPKI roots in the client.macros: Provides a#[derive(TrinoRow)]macro for deserializing query results into a Ruststruct.
What this library provides
This is a bit of a grab-bag of types and utilities, driven by the common needs of several related tools.
Storage transforms
This is the heart of the library. This library exists because Trino doesn't
store any data itself. Instead, it delegates storage to connectors. And
these connectors expose nearly all the limitations of the underlying storage
system. They're often missing key data types, or don't support NOT NULL,
or don't support transactions. The following types help generate code that
works around these limitations:
ConnectorTypeis the main entry point to this part of the library, providing an API to describe a connector's limitations. See this section for example code!StorageTransformdescribes how to transform data when storing it using a specific connector, and when reading it back.
Basic utility types
These are included mostly because they're needed by other parts of the library.
DataTypeandField, which describe a subset of available data types in Trino.Ident, which represents and prints a simple Trino identifier.QuotedString, which formats a quoted and escaped string.TableOptions, which represents theWITHclause of aCREATE TABLEstatement.
Values (requires the values feature)
Valuerepresents a subset of Trino's values.IsCloseEnoughTois a trait for comparing values that knows about the limitations of Trino's connectors.
Other features
crate::proptest(requires theproptestfeature) provides tools for generating random values for testing.crate::client(requires theclientfeature) provides a basic Trino client.
dbcrossbar_trino: A lightweight Trino interface for dbcrossbar and related tools
This crate is a support crate shared by dbcrossbar and related tools. It provides:
- Tools for working around limitations of various Trino connectors
- Tools for listing which features are supported by a given Trino connector.
- Tools for translating common Trino data types to "storage" types that are supported by a given connector.
- A simple Trino client, intended for testing.
- A dynamic representation of Trino values, and the ability to format them as SQL.
- Other miscellaneous utilities that are useful for working with Trino.
You are welcome to use this crate outside of dbcrossbar if you find it useful. We plan to obey semver. But the features supported by this crate will be driven largely by dbcrossbar and related tools.
For more information, see the documentation.
Dependencies
~2–20MB
~219K SLoC