Skip to main content

Connector

Struct Connector 

Source
pub struct Connector { /* private fields */ }
Expand description

Bundles a CatalogProvider with TableReaders for convenient use.

The Connector is the primary entry point for interacting with an external catalog. It delegates metadata operations to the catalog provider and data reading to the appropriate table reader based on the table’s data format.

§Storage Options

Cloud storage credentials (S3, Azure, GCS) are passed via storage_options and forwarded to each TableReader during table registration.

§Extensibility

  • Swap the catalog: pass a different CatalogProvider (e.g., AWS Glue).
  • Add formats: pass additional TableReaders (e.g., Iceberg).

§Example

// let connector = Connector::new(catalog, readers)
//     .with_storage_options(HashMap::from([
//         ("aws_access_key_id".into(), "...".into()),
//         ("aws_secret_access_key".into(), "...".into()),
//     ]));

Implementations§

Source§

impl Connector

Source

pub fn new( catalog: Arc<dyn CatalogProvider>, readers: Vec<Arc<dyn TableReader>>, ) -> Self

Create a new connector with the given catalog provider and table readers.

Source

pub fn with_storage_options(self, options: HashMap<String, String>) -> Self

Set storage options for cloud storage access (S3, Azure, GCS).

Common keys:

  • S3: aws_access_key_id, aws_secret_access_key, aws_region
  • Azure: azure_storage_account_name, azure_storage_account_key
  • GCS: google_service_account_path
Source

pub fn storage_options(&self) -> &HashMap<String, String>

Get the current storage options.

Source

pub fn catalog(&self) -> &dyn CatalogProvider

Get a reference to the underlying catalog provider.

Source

pub fn reader_for(&self, format: &DataSourceFormat) -> Option<&dyn TableReader>

Find a table reader that supports the given data format.

Source

pub fn readers(&self) -> &[Arc<dyn TableReader>]

List all available table readers.

Source

pub async fn list_catalogs(&self) -> CatalogResult<Vec<CatalogInfo>>

Source

pub async fn get_catalog(&self, name: &str) -> CatalogResult<CatalogInfo>

Source

pub async fn list_schemas( &self, catalog_name: &str, ) -> CatalogResult<Vec<SchemaInfo>>

Source

pub async fn get_schema( &self, catalog_name: &str, schema_name: &str, ) -> CatalogResult<SchemaInfo>

Source

pub async fn list_tables( &self, catalog_name: &str, schema_name: &str, ) -> CatalogResult<Vec<TableInfo>>

Source

pub async fn get_table( &self, catalog_name: &str, schema_name: &str, table_name: &str, ) -> CatalogResult<TableInfo>

Source

pub async fn register_schema( &self, ctx: &SessionContext, catalog_name: &str, schema_name: &str, ) -> CatalogResult<Vec<(String, SchemaRef)>>

Register all tables from a catalog schema into a DataFusion SessionContext.

For each table:

  1. Retrieves full table metadata (including columns) from the catalog.
  2. Converts columns to an Arrow schema.
  3. Finds an appropriate TableReader for the table’s data format.
  4. Registers the table in the session context with storage options for cloud access.

If no reader matches the table’s format, falls back to registering an empty MemTable with the correct schema (schema-only, for planning).

Individual table failures are logged as warnings but do not abort the registration of remaining tables.

Returns a list of (table_name, schema) for successfully registered tables.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,