Registers a JSON file as a table that it can be referenced from SQL statements executed against this context.
(
&self,
table_ref: impl Into<TableReference>,
table_path: impl AsRef<str>,
options: JsonReadOptions<'_>,
)
| 40 | /// Registers a JSON file as a table that it can be referenced |
| 41 | /// from SQL statements executed against this context. |
| 42 | pub async fn register_json( |
| 43 | &self, |
| 44 | table_ref: impl Into<TableReference>, |
| 45 | table_path: impl AsRef<str>, |
| 46 | options: JsonReadOptions<'_>, |
| 47 | ) -> Result<()> { |
| 48 | let listing_options = options |
| 49 | .to_listing_options(&self.copied_config(), self.copied_table_options()); |
| 50 | |
| 51 | self.register_type_check(table_path.as_ref(), &listing_options.file_extension)?; |
| 52 | |
| 53 | self.register_listing_table( |
| 54 | table_ref, |
| 55 | table_path, |
| 56 | listing_options, |
| 57 | options.schema.map(|s| Arc::new(s.to_owned())), |
| 58 | None, |
| 59 | ) |
| 60 | .await?; |
| 61 | Ok(()) |
| 62 | } |
| 63 | |
| 64 | /// Executes a query and writes the results to a partitioned JSON file. |
| 65 | pub async fn write_json( |