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

Commit 7bab3ac

Browse files
authored
Merge pull request #248 from datafold/issue246
Added support for specifying db-name in CLI instead of URI when using --conf
2 parents 67171cb + 770bd3b commit 7bab3ac

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

data_diff/config.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,20 @@ def _apply_config(config: Dict[str, Any], run_name: str, kw: Dict[str, Any]):
2626
else:
2727
run_name = "default"
2828

29+
if 'database1' in kw:
30+
for attr in ('table1', 'database2', 'table2'):
31+
if kw[attr] is None:
32+
raise ValueError(f"Specified database1 but not {attr}. Must specify all 4 arguments, or niether.")
33+
34+
for index in "12":
35+
run_args[index] = {attr: kw.pop(f"{attr}{index}") for attr in ('database', 'table')}
36+
2937
# Process databases + tables
3038
for index in "12":
3139
args = run_args.pop(index, {})
3240
for attr in ("database", "table"):
3341
if attr not in args:
34-
raise ConfigParseError(f"Running 'run.{run_name}': Connection #{index} in missing attribute '{attr}'.")
42+
raise ConfigParseError(f"Running 'run.{run_name}': Connection #{index} is missing attribute '{attr}'.")
3543

3644
database = args.pop("database")
3745
table = args.pop("table")

0 commit comments

Comments
 (0)