pub struct TesseraClient { /* private fields */ }Expand description
A synchronous client for the Tessera API.
Call TesseraClient::new with an explicit API key or rely on
$TESSERA_API_KEY.
§Panics
The constructor builds a private tokio runtime (needed for Polars cloud
reads), so a TesseraClient must not be constructed or used from inside
another async runtime — use crate::AsyncTesseraClient there instead.
Implementations§
Source§impl TesseraClient
impl TesseraClient
Sourcepub fn new(api_key: Option<&str>) -> Result<Self, TesseraError>
pub fn new(api_key: Option<&str>) -> Result<Self, TesseraError>
Create a client with defaults, resolving the key from api_key or
$TESSERA_API_KEY.
§Errors
Returns TesseraError::Configuration when no API key can be resolved.
Sourcepub fn from_config(config: ClientConfig) -> Result<Self, TesseraError>
pub fn from_config(config: ClientConfig) -> Result<Self, TesseraError>
Create a client from a fully-specified ClientConfig.
§Errors
Returns TesseraError::Network when the HTTP client or tokio runtime
cannot be built.
Sourcepub fn config(&self) -> &ClientConfig
pub fn config(&self) -> &ClientConfig
The resolved configuration this client was built with.
Sourcepub fn datasets(&self) -> Result<DatasetsResponse, TesseraError>
pub fn datasets(&self) -> Result<DatasetsResponse, TesseraError>
List every dataset visible to your plan.
§Errors
Returns any TesseraError the API or transport raises.
Sourcepub fn partitions(
&self,
asset: &str,
coin: Option<&str>,
month: Option<&str>,
) -> Result<PartitionsResponse, TesseraError>
pub fn partitions( &self, asset: &str, coin: Option<&str>, month: Option<&str>, ) -> Result<PartitionsResponse, TesseraError>
List the partitions of asset, optionally filtered by coin/month.
§Errors
Returns any TesseraError the API or transport raises.
Sourcepub fn download_url(
&self,
asset: &str,
coin: &str,
month: &str,
) -> Result<DownloadResponse, TesseraError>
pub fn download_url( &self, asset: &str, coin: &str, month: &str, ) -> Result<DownloadResponse, TesseraError>
Mint a short-lived presigned download URL for one partition.
§Errors
Returns any TesseraError the API or transport raises.
Sourcepub fn partition_refs(
&self,
asset: &str,
coin: impl IntoCoins,
month: impl IntoMonths,
) -> Result<Vec<PartitionRef>, TesseraError>
pub fn partition_refs( &self, asset: &str, coin: impl IntoCoins, month: impl IntoMonths, ) -> Result<Vec<PartitionRef>, TesseraError>
Expand (asset, coins, months) into concrete partition references.
§Errors
Returns TesseraError::InvalidArgument on empty/invalid arguments.
Sourcepub fn scan(
&self,
asset: &str,
coin: impl IntoCoins,
month: impl IntoMonths,
columns: Option<&[&str]>,
) -> Result<LazyFrame, TesseraError>
pub fn scan( &self, asset: &str, coin: impl IntoCoins, month: impl IntoMonths, columns: Option<&[&str]>, ) -> Result<LazyFrame, TesseraError>
Lazily scan one or more partitions into a Polars LazyFrame.
URLs are minted now but the data is read on .collect(). Because
presigned URLs expire (~15 min), collect promptly; for long-lived
graphs re-run scan to refresh.
§Errors
Returns any TesseraError the API or transport raises.
Sourcepub fn read(
&self,
asset: &str,
coin: impl IntoCoins,
month: impl IntoMonths,
columns: Option<&[&str]>,
) -> Result<DataFrame, TesseraError>
pub fn read( &self, asset: &str, coin: impl IntoCoins, month: impl IntoMonths, columns: Option<&[&str]>, ) -> Result<DataFrame, TesseraError>
Eagerly read one or more partitions into a Polars DataFrame.
§Errors
Returns any TesseraError the API or transport raises, including
TesseraError::PresignExpired for rejected presigned URLs.
Sourcepub fn to_duckdb(
&self,
asset: &str,
coin: impl IntoCoins,
month: impl IntoMonths,
columns: Option<&[&str]>,
) -> Result<Connection, TesseraError>
pub fn to_duckdb( &self, asset: &str, coin: impl IntoCoins, month: impl IntoMonths, columns: Option<&[&str]>, ) -> Result<Connection, TesseraError>
Open one or more partitions as an in-memory DuckDB connection exposing
a tessera view for SQL querying.
§Errors
Returns any TesseraError the API or transport raises.
Trait Implementations§
Source§impl Debug for TesseraClient
impl Debug for TesseraClient
Source§impl Drop for TesseraClient
impl Drop for TesseraClient
Auto Trait Implementations§
impl !Freeze for TesseraClient
impl !RefUnwindSafe for TesseraClient
impl !UnwindSafe for TesseraClient
impl Send for TesseraClient
impl Sync for TesseraClient
impl Unpin for TesseraClient
impl UnsafeUnpin for TesseraClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more