Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 9fe6374

Browse files
Attsun1031dlawin
authored andcommitted
Fix tuple handling
1 parent d5946a7 commit 9fe6374

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

data_diff/config.py

+5
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ def _apply_config(config: Dict[str, Any], run_name: str, kw: Dict[str, Any]):
3838
for index in "12":
3939
run_args[index] = {attr: kw.pop(f"{attr}{index}") for attr in ("database", "table")}
4040

41+
# Make sure array fields are decoded as list, since array fields in toml are decoded as list, but TableSegment object requires tuple type.
42+
for field in ["key_columns", "columns"]:
43+
if isinstance(run_args.get(field), list):
44+
run_args[field] = tuple(run_args[field])
45+
4146
# Process databases + tables
4247
for index in "12":
4348
try:

tests/test_config.py

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ def test_basic(self):
1515
1616
[run.default]
1717
update_column = "timestamp"
18+
key_columns = ["id"]
19+
columns = ["name", "age"]
1820
verbose = true
1921
threads = 2
2022
@@ -39,6 +41,8 @@ def test_basic(self):
3941
assert res["table2"] == "rating_del1"
4042
assert res["threads1"] == 11
4143
assert res["threads2"] == 22
44+
assert res["key_columns"] == ("id",)
45+
assert res["columns"] == ("name","age")
4246

4347
res = apply_config_from_string(config, "pg_pg", {"update_column": "foo", "table2": "bar"})
4448
assert res["update_column"] == "foo"

0 commit comments

Comments
 (0)