@@ -66,27 +66,13 @@ def __arrow_c_array__( # noqa: D105
6666class SessionConfig :
6767 """Session configuration options."""
6868
69- def __init__ (self , config_options : dict [str , str ] | None = None , enable_url_table : bool = False ) -> None :
69+ def __init__ (self , config_options : dict [str , str ] | None = None ) -> 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
9076
9177 def with_create_default_catalog_and_schema (
9278 self , enabled : bool = True
@@ -481,11 +467,22 @@ def __init__(
481467 ctx = SessionContext()
482468 df = ctx.read_csv("data.csv")
483469 """
484- enable_url_table = config .enable_url_table if config is not None else False
485470 config = config .config_internal if config is not None else None
486471 runtime = runtime .config_internal if runtime is not None else None
487472
488- self .ctx = SessionContextInternal (config , runtime , enable_url_table )
473+ self .ctx = SessionContextInternal (config , runtime )
474+
475+ def enable_url_table (self ) -> "SessionContext" :
476+
477+ """Control if local files can be queried as tables.
478+
479+ Returns:
480+ A new :py:class:`SessionContext` object with url table enabled.
481+ """
482+ klass = self .__class__
483+ obj = klass .__new__ (klass )
484+ obj .ctx = self .ctx .enable_url_table ()
485+ return obj
489486
490487 def register_object_store (
491488 self , schema : str , store : Any , host : str | None = None
0 commit comments