@@ -66,13 +66,27 @@ def __arrow_c_array__( # noqa: D105
6666class SessionConfig :
6767 """Session configuration options."""
6868
69- def __init__ (self , config_options : dict [str , str ] | None = None ) -> None :
69+ def __init__ (self , config_options : dict [str , str ] | None = None , enable_url_table : bool = False ) -> None :
7070 """Create a new :py:class:`SessionConfig` with the given configuration options.
7171
7272 Args:
7373 config_options: Configuration options.
7474 """
7575 self .config_internal = SessionConfigInternal (config_options )
76+ self .enable_url_table = enable_url_table
77+
78+ def with_url_table (self , enabled : bool = True ) -> SessionConfig :
79+
80+ """Control if local files can be queried as tables.
81+
82+ Args:
83+ enabled: Whether local files can be queried as tables.
84+
85+ Returns:
86+ A new :py:class:`SessionConfig` object with the updated setting.
87+ """
88+ self .enable_url_table = enabled
89+ return self
7690
7791 def with_create_default_catalog_and_schema (
7892 self , enabled : bool = True
@@ -467,10 +481,11 @@ def __init__(
467481 ctx = SessionContext()
468482 df = ctx.read_csv("data.csv")
469483 """
484+ enable_url_table = config .enable_url_table if config is not None else False
470485 config = config .config_internal if config is not None else None
471486 runtime = runtime .config_internal if runtime is not None else None
472487
473- self .ctx = SessionContextInternal (config , runtime )
488+ self .ctx = SessionContextInternal (config , runtime , enable_url_table )
474489
475490 def register_object_store (
476491 self , schema : str , store : Any , host : str | None = None
0 commit comments