From b20bfdf073f2fe02a5965b9cae543ce37cbc6da9 Mon Sep 17 00:00:00 2001 From: Leo Folsom Date: Tue, 1 Nov 2022 11:37:20 -0700 Subject: [PATCH] update logic of args object in config.py --- data_diff/config.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/data_diff/config.py b/data_diff/config.py index 941e2643..a4821805 100644 --- a/data_diff/config.py +++ b/data_diff/config.py @@ -26,7 +26,7 @@ def _apply_config(config: Dict[str, Any], run_name: str, kw: Dict[str, Any]): else: run_name = "default" - if "database1" in kw: + if kw.get("database1") is not None: for attr in ("table1", "database2", "table2"): if kw[attr] is None: raise ValueError(f"Specified database1 but not {attr}. Must specify all 4 arguments, or niether.") @@ -36,7 +36,8 @@ def _apply_config(config: Dict[str, Any], run_name: str, kw: Dict[str, Any]): # Process databases + tables for index in "12": - args = run_args.pop(index, {}) + args_with_db_num = {k: run_args.get(k,None) for k in (f"database{index}", f"table{index}", f"threads{index}")} + args = {k.replace(index,''):v for k,v in args_with_db_num.items()} for attr in ("database", "table"): if attr not in args: raise ConfigParseError(f"Running 'run.{run_name}': Connection #{index} is missing attribute '{attr}'.")