diff --git a/cosmos/operators/watcher.py b/cosmos/operators/watcher.py index ee77b360cf..b721bae2e5 100644 --- a/cosmos/operators/watcher.py +++ b/cosmos/operators/watcher.py @@ -98,6 +98,10 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: task_id = kwargs.pop("task_id", PRODUCER_WATCHER_TASK_ID) self.tests_per_model: dict[str, list[str]] = kwargs.pop("tests_per_model", {}) self.test_results_per_model: dict[str, list[str]] = {} + # Do not publish compiled_sql to the producer's rendered_template: it would contain SQL for + # all models run by the producer, is often truncated in the UI due to size, and is of no use + # there; individual sensor tasks show the corresponding rendered_template per model. + kwargs["should_store_compiled_sql"] = False kwargs.setdefault("priority_weight", PRODUCER_WATCHER_DEFAULT_PRIORITY_WEIGHT) kwargs.setdefault("weight_rule", WATCHER_TASK_WEIGHT_RULE) # Consumer watcher retry logic handles model-level reruns using the LOCAL execution mode; rerunning the producer diff --git a/tests/operators/test_watcher.py b/tests/operators/test_watcher.py index 738c2a2b6c..e4e54670bd 100644 --- a/tests/operators/test_watcher.py +++ b/tests/operators/test_watcher.py @@ -115,6 +115,12 @@ def test_dbt_producer_watcher_operator_priority_weight_default(): assert op.priority_weight == PRODUCER_WATCHER_DEFAULT_PRIORITY_WEIGHT +def test_dbt_producer_watcher_operator_does_not_store_compiled_sql_on_template(): + """Producer does not publish compiled_sql to its rendered_template; sensors show it per model.""" + op = DbtProducerWatcherOperator(project_dir=".", profile_config=None) + assert op.should_store_compiled_sql is False + + @pytest.mark.parametrize( "queue_override, expected_queue", [