Registers an Avro file as a table that can be referenced from SQL statements executed against this context.
(
&self,
table_ref: impl Into<TableReference>,
table_path: impl AsRef<str>,
options: AvroReadOptions<'_>,
)
| 38 | /// Registers an Avro file as a table that can be referenced from |
| 39 | /// SQL statements executed against this context. |
| 40 | pub async fn register_avro( |
| 41 | &self, |
| 42 | table_ref: impl Into<TableReference>, |
| 43 | table_path: impl AsRef<str>, |
| 44 | options: AvroReadOptions<'_>, |
| 45 | ) -> Result<()> { |
| 46 | let listing_options = options |
| 47 | .to_listing_options(&self.copied_config(), self.copied_table_options()); |
| 48 | |
| 49 | self.register_type_check(table_path.as_ref(), &listing_options.file_extension)?; |
| 50 | |
| 51 | self.register_listing_table( |
| 52 | table_ref, |
| 53 | table_path, |
| 54 | listing_options, |
| 55 | options.schema.map(|s| Arc::new(s.to_owned())), |
| 56 | None, |
| 57 | ) |
| 58 | .await?; |
| 59 | Ok(()) |
| 60 | } |
| 61 | } |