MCPcopy Create free account
hub / github.com/apache/datafusion / register_csv

Method register_csv

datafusion/core/src/execution/context/csv.rs:63–84  ·  view source on GitHub ↗

Registers a CSV file as a table which can referenced from SQL statements executed against this context.

(
        &self,
        table_ref: impl Into<TableReference>,
        table_path: impl AsRef<str>,
        options: CsvReadOptions<'_>,
    )

Source from the content-addressed store, hash-verified

61 /// Registers a CSV file as a table which can referenced from SQL
62 /// statements executed against this context.
63 pub async fn register_csv(
64 &self,
65 table_ref: impl Into<TableReference>,
66 table_path: impl AsRef<str>,
67 options: CsvReadOptions<'_>,
68 ) -> Result<()> {
69 let listing_options = options
70 .to_listing_options(&self.copied_config(), self.copied_table_options());
71
72 self.register_type_check(table_path.as_ref(), &listing_options.file_extension)?;
73
74 self.register_listing_table(
75 table_ref,
76 table_path,
77 listing_options,
78 options.schema.map(|s| Arc::new(s.to_owned())),
79 None,
80 )
81 .await?;
82
83 Ok(())
84 }
85
86 /// Executes a query and writes the results to a partitioned CSV file.
87 pub async fn write_csv(

Callers 15

register_cars_test_dataFunction · 0.45
create_contextFunction · 0.45
create_contextFunction · 0.45
query_http_csvFunction · 0.45
query_aws_s3Function · 0.45
regexpFunction · 0.45
csv_sql_streamingFunction · 0.45
roundtrip_logical_planFunction · 0.45

Calls 8

newFunction · 0.85
to_listing_optionsMethod · 0.80
copied_configMethod · 0.80
copied_table_optionsMethod · 0.80
register_type_checkMethod · 0.80
as_refMethod · 0.45
mapMethod · 0.45