Enable querying local files as tables. This feature is security sensitive and should only be enabled for systems that wish to permit direct access to the file system from SQL. When enabled, this feature permits direct access to arbitrary files via SQL like ```sql SELECT * from 'my_file.parquet' ``` See [DynamicFileCatalog] for more details ``` # use datafusion::prelude::*; # use datafusion::{
(self)
| 412 | /// # } |
| 413 | /// ``` |
| 414 | pub fn enable_url_table(self) -> Self { |
| 415 | let current_catalog_list = Arc::clone(self.state.read().catalog_list()); |
| 416 | let factory = Arc::new(DynamicListTableFactory::new(SessionStore::new())); |
| 417 | let catalog_list = Arc::new(DynamicFileCatalog::new( |
| 418 | current_catalog_list, |
| 419 | Arc::clone(&factory) as Arc<dyn UrlTableFactory>, |
| 420 | )); |
| 421 | |
| 422 | let session_id = self.session_id.clone(); |
| 423 | let ctx: SessionContext = self |
| 424 | .into_state_builder() |
| 425 | .with_session_id(session_id) |
| 426 | .with_catalog_list(catalog_list) |
| 427 | .build() |
| 428 | .into(); |
| 429 | // register new state with the factory |
| 430 | factory.session_store().with_state(ctx.state_weak_ref()); |
| 431 | ctx |
| 432 | } |
| 433 | |
| 434 | /// Convert the current `SessionContext` into a [`SessionStateBuilder`] |
| 435 | /// |