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<'_>,
)
| 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( |