pub struct StaticTablesConfigurator { /* private fields */ }Expand description
A SessionConfigurator that auto-discovers JSON and CSV files under an object store URL and registers each as a queryable DataFusion table.
Table names are derived from the filename stem (e.g., event_schemas.json → event_schemas).
§Example
use anyhow::Result;
use datafusion::execution::context::SessionContext;
use micromegas_analytics::lakehouse::static_tables_configurator::StaticTablesConfigurator;
use micromegas_analytics::lakehouse::session_configurator::SessionConfigurator;
#[tokio::main]
async fn main() -> Result<()> {
let ctx = SessionContext::new();
let configurator = StaticTablesConfigurator::new(&ctx, "file:///data/tables/").await?;
// Later, configure a session:
configurator.configure(&ctx).await?;
Ok(())
}Implementations§
Source§impl StaticTablesConfigurator
impl StaticTablesConfigurator
Sourcepub async fn from_env(
env_var: &str,
runtime: Arc<RuntimeEnv>,
) -> Result<Arc<dyn SessionConfigurator>, Error>
pub async fn from_env( env_var: &str, runtime: Arc<RuntimeEnv>, ) -> Result<Arc<dyn SessionConfigurator>, Error>
Load static tables from the URL in the given environment variable.
Returns NoOpSessionConfigurator when the variable is unset.
Errors if the variable is set but loading fails (preserves fail-fast behavior).
Sourcepub async fn new(
ctx: &SessionContext,
url: &str,
) -> Result<StaticTablesConfigurator, Error>
pub async fn new( ctx: &SessionContext, url: &str, ) -> Result<StaticTablesConfigurator, Error>
Discovers JSON and CSV files under the given URL and creates table providers for each.
Files with .json extensions are loaded as JSON tables.
Files with .csv extensions are loaded as CSV tables.
Other extensions are skipped with a warning.
Errors loading individual files are logged but do not prevent other files from loading.
Trait Implementations§
Source§impl Debug for StaticTablesConfigurator
impl Debug for StaticTablesConfigurator
Source§impl SessionConfigurator for StaticTablesConfigurator
impl SessionConfigurator for StaticTablesConfigurator
Source§fn configure<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 SessionContext,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
StaticTablesConfigurator: 'async_trait,
fn configure<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 SessionContext,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
StaticTablesConfigurator: 'async_trait,
Auto Trait Implementations§
impl Freeze for StaticTablesConfigurator
impl !RefUnwindSafe for StaticTablesConfigurator
impl Send for StaticTablesConfigurator
impl Sync for StaticTablesConfigurator
impl Unpin for StaticTablesConfigurator
impl !UnwindSafe for StaticTablesConfigurator
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<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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].