Skip to content

Commit 7d6d75c

Browse files
R-112: Add --diagnostics-warehouse CLI parameter (#2362)
* Add `--diagnostics-warehouse` CLI parameter * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 35231ed commit 7d6d75c

4 files changed

Lines changed: 44 additions & 1 deletion

File tree

soda-core/src/soda_core/cli/cli.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,15 @@ def _setup_contract_verify_command(contract_parsers) -> None:
153153
help="Show more detailed logs on the console.",
154154
)
155155

156+
# TODO: move into extensions
157+
verify_parser.add_argument(
158+
"-dw",
159+
"--diagnostics-warehouse",
160+
type=str,
161+
nargs="?",
162+
help="Specify the path to the diagnostics warehouse configuration file. ",
163+
)
164+
156165
def handle(args):
157166
contract_file_paths = args.contract
158167
dataset_identifiers = args.dataset
@@ -165,6 +174,7 @@ def handle(args):
165174
verbose = args.verbose
166175
use_agent = args.use_agent
167176
blocking_timeout_in_minutes = args.blocking_timeout_in_minutes
177+
diagnostics_warehouse_file_path = args.diagnostics_warehouse
168178

169179
exit_code = handle_verify_contract(
170180
contract_file_paths,
@@ -176,6 +186,7 @@ def handle(args):
176186
verbose,
177187
use_agent,
178188
blocking_timeout_in_minutes,
189+
diagnostics_warehouse_file_path,
179190
)
180191

181192
exit_with_code(exit_code)

soda-core/src/soda_core/cli/handlers/contract.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def handle_verify_contract(
2525
verbose: bool,
2626
use_agent: bool,
2727
blocking_timeout_in_minutes: int,
28+
diagnostics_warehouse_file_path: Optional[str],
2829
) -> ExitCode:
2930
try:
3031
contract_verification_result = verify_contracts(
@@ -38,6 +39,7 @@ def handle_verify_contract(
3839
verbose=verbose,
3940
use_agent=use_agent,
4041
blocking_timeout_in_minutes=blocking_timeout_in_minutes,
42+
dwh_data_source_file_path=diagnostics_warehouse_file_path,
4143
)
4244

4345
return interpret_contract_verification_result(contract_verification_result)

soda-tests/tests/components/test_cli.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
True,
4646
True,
4747
42,
48+
None,
4849
],
4950
),
5051
(
@@ -76,6 +77,7 @@
7677
True,
7778
True,
7879
42,
80+
None,
7981
],
8082
),
8183
(
@@ -90,7 +92,34 @@
9092
"-sc",
9193
"cloud.yaml",
9294
],
93-
[None, ["some-dataset"], ["ds.yaml"], "cloud.yaml", {}, False, False, False, 60],
95+
[None, ["some-dataset"], ["ds.yaml"], "cloud.yaml", {}, False, False, False, 60, None],
96+
),
97+
(
98+
[
99+
"soda",
100+
"contract",
101+
"verify",
102+
"-d",
103+
"some-dataset",
104+
"-ds",
105+
"ds.yaml",
106+
"-sc",
107+
"cloud.yaml",
108+
"-dw",
109+
"diagnostics_warehouse.yaml",
110+
],
111+
[
112+
None,
113+
["some-dataset"],
114+
["ds.yaml"],
115+
"cloud.yaml",
116+
{},
117+
False,
118+
False,
119+
False,
120+
60,
121+
"diagnostics_warehouse.yaml",
122+
],
94123
),
95124
],
96125
)

soda-tests/tests/components/test_cli_contract_handlers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def test_handle_verify_contract_exit_codes(
5252
verbose=False,
5353
use_agent=False,
5454
blocking_timeout_in_minutes=10,
55+
diagnostics_warehouse_file_path=None,
5556
)
5657

5758
assert exit_code == expected_exit_code

0 commit comments

Comments
 (0)