@@ -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