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

Commit 6838c46

Browse files
authored
Merge branch 'master' into DX-721
2 parents 8f07c1c + 8772c47 commit 6838c46

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

data_diff/__main__.py

+1
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ def main(conf, run, **kw):
316316
dbt_selection=kw["select"],
317317
json_output=kw["json_output"],
318318
state=state,
319+
where_flag=kw["where"],
319320
)
320321
else:
321322
return _data_diff(

data_diff/dbt.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def dbt_diff(
7070
json_output: bool = False,
7171
state: Optional[str] = None,
7272
log_status_handler: Optional[LogStatusHandler] = None,
73+
where_flag: Optional[str] = None,
7374
) -> None:
7475
print_version_info()
7576
diff_threads = []
@@ -109,7 +110,7 @@ def dbt_diff(
109110
if log_status_handler:
110111
log_status_handler.set_prefix(f"Diffing {model.alias} \n")
111112

112-
diff_vars = _get_diff_vars(dbt_parser, config, model)
113+
diff_vars = _get_diff_vars(dbt_parser, config, model, where_flag)
113114

114115
# we won't always have a prod path when using state
115116
# when the model DNE in prod manifest, skip the model diff
@@ -158,6 +159,7 @@ def _get_diff_vars(
158159
dbt_parser: "DbtParser",
159160
config: TDatadiffConfig,
160161
model,
162+
where_flag: Optional[str] = None,
161163
) -> TDiffVars:
162164
dev_database = model.database
163165
dev_schema = model.schema_
@@ -187,7 +189,8 @@ def _get_diff_vars(
187189
primary_keys=primary_keys,
188190
connection=dbt_parser.connection,
189191
threads=dbt_parser.threads,
190-
where_filter=datadiff_model_config.where_filter,
192+
# --where takes precedence over any model level config
193+
where_filter=where_flag or datadiff_model_config.where_filter,
191194
include_columns=datadiff_model_config.include_columns,
192195
exclude_columns=datadiff_model_config.exclude_columns,
193196
)

0 commit comments

Comments
 (0)