Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/create-context.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@
)
ctx = SessionContext(config, runtime)
print(ctx)

ctx = ctx.enable_url_table()
print(ctx)
11 changes: 11 additions & 0 deletions python/datafusion/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,17 @@ def __init__(

self.ctx = SessionContextInternal(config, runtime)

def enable_url_table(self) -> "SessionContext":
"""Control if local files can be queried as tables.

Returns:
A new :py:class:`SessionContext` object with url table enabled.
"""
klass = self.__class__
obj = klass.__new__(klass)
obj.ctx = self.ctx.enable_url_table()
return obj

def register_object_store(
self, schema: str, store: Any, host: str | None = None
) -> None:
Expand Down
6 changes: 6 additions & 0 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ impl PySessionContext {
})
}

pub fn enable_url_table(&self) -> PyResult<Self> {
Ok(PySessionContext {
ctx: self.ctx.clone().enable_url_table(),
})
}

/// Register an object store with the given name
#[pyo3(signature = (scheme, store, host=None))]
pub fn register_object_store(
Expand Down