csv_table_provider

Function csv_table_provider 

Source
pub async fn csv_table_provider(
    ctx: &SessionContext,
    url: &str,
) -> Result<Arc<dyn TableProvider>, Error>
Expand description

Creates a TableProvider for a CSV file with pre-computed schema

This function infers the schema once and returns a TableProvider that can be registered in multiple SessionContexts without re-inferring the schema.

Assumes CSV files have a header row and use comma delimiters.

§Arguments

  • ctx - A SessionContext used for schema inference and object store access
  • url - URL to the CSV file (e.g., “file:///path/to/data.csv” or “s3://bucket/data.csv”)

§Returns

Returns an Arc<dyn TableProvider> that can be registered using SessionContext::register_table().