Finds any [`ListingSchemaProvider`]s and instructs them to reload tables from "disk"
(&self)
| 313 | |
| 314 | /// Finds any [`ListingSchemaProvider`]s and instructs them to reload tables from "disk" |
| 315 | pub async fn refresh_catalogs(&self) -> Result<()> { |
| 316 | let cat_names = self.catalog_names().clone(); |
| 317 | for cat_name in cat_names.iter() { |
| 318 | let cat = self |
| 319 | .catalog(cat_name.as_str()) |
| 320 | .ok_or_else(|| internal_datafusion_err!("Catalog not found!"))?; |
| 321 | for schema_name in cat.schema_names() { |
| 322 | let schema = cat |
| 323 | .schema(schema_name.as_str()) |
| 324 | .ok_or_else(|| internal_datafusion_err!("Schema not found!"))?; |
| 325 | let lister = schema.downcast_ref::<ListingSchemaProvider>(); |
| 326 | if let Some(lister) = lister { |
| 327 | lister.refresh(&self.state()).await?; |
| 328 | } |
| 329 | } |
| 330 | } |
| 331 | Ok(()) |
| 332 | } |
| 333 | |
| 334 | /// Creates a new `SessionContext` using the provided |
| 335 | /// [`SessionConfig`] and a new [`RuntimeEnv`]. |
no test coverage detected