Skip to content

Commit 02414d8

Browse files
authored
Fix SessionContext init with only SessionConfig (#827)
Previously creating a `SessionContext` when specifying only a `SessionConfig` would error.
1 parent 3b5085e commit 02414d8

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

python/datafusion/context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ def __init__(
445445
df = ctx.read_csv("data.csv")
446446
"""
447447
config = config.config_internal if config is not None else None
448-
runtime = runtime.config_internal if config is not None else None
448+
runtime = runtime.config_internal if runtime is not None else None
449449

450450
self.ctx = SessionContextInternal(config, runtime)
451451

python/datafusion/tests/test_context.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ def test_create_context_no_args():
3838
SessionContext()
3939

4040

41+
def test_create_context_session_config_only():
42+
SessionContext(config=SessionConfig())
43+
44+
45+
def test_create_context_runtime_config_only():
46+
SessionContext(runtime=RuntimeConfig())
47+
48+
4149
@pytest.mark.parametrize("path_to_str", (True, False))
4250
def test_runtime_configs(tmp_path, path_to_str):
4351
path1 = tmp_path / "dir1"

0 commit comments

Comments
 (0)