diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f71af2abd9..6716145fbe 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,13 @@ Changelog ========= +1.12.1a1 (2025-12-26) +---------------------- + +Bug Fixes + +* Fix ``DbtSourceWatcherOperator.template_fields`` to inherit from ``DbtSourceLocalOperator`` instead of ``DbtConsumerWatcherSensor`` by @pankajkoti in #2214 + 1.12.0 (2025-12-18) ---------------------- diff --git a/cosmos/__init__.py b/cosmos/__init__.py index d113ba240b..be4f762632 100644 --- a/cosmos/__init__.py +++ b/cosmos/__init__.py @@ -9,7 +9,7 @@ from cosmos import settings -__version__ = "1.12.0" +__version__ = "1.12.1a1" if not settings.enable_memory_optimised_imports: from cosmos.airflow.dag import DbtDag diff --git a/cosmos/operators/watcher.py b/cosmos/operators/watcher.py index 1c44191df8..282e8706b5 100644 --- a/cosmos/operators/watcher.py +++ b/cosmos/operators/watcher.py @@ -4,6 +4,7 @@ import json import logging import zlib +from collections.abc import Sequence from datetime import timedelta from pathlib import Path from typing import TYPE_CHECKING, Any @@ -503,7 +504,7 @@ class DbtSourceWatcherOperator(DbtSourceLocalOperator): Executes a dbt source freshness command, synchronously, as ExecutionMode.LOCAL. """ - template_fields: tuple[str, ...] = DbtConsumerWatcherSensor.template_fields + template_fields: Sequence[str] = DbtSourceLocalOperator.template_fields # type: ignore[assignment] class DbtRunWatcherOperator(DbtConsumerWatcherSensor): diff --git a/tests/operators/test_watcher.py b/tests/operators/test_watcher.py index eb545bb879..d8d34886ed 100644 --- a/tests/operators/test_watcher.py +++ b/tests/operators/test_watcher.py @@ -1287,3 +1287,16 @@ def test_sensor_and_producer_different_param_values(mock_bigquery_conn): assert task.execution_timeout == timedelta(seconds=2) else: assert task.execution_timeout == timedelta(seconds=1) + + +def test_dbt_source_watcher_operator_template_fields(): + """Test that DbtSourceWatcherOperator doesn't include model_unique_id in template_fields.""" + from cosmos.operators.local import DbtSourceLocalOperator + from cosmos.operators.watcher import DbtSourceWatcherOperator + + # DbtSourceWatcherOperator should NOT have model_unique_id in template_fields + # because it runs locally and doesn't watch models, it executes source freshness + assert "model_unique_id" not in DbtSourceWatcherOperator.template_fields + + # DbtSourceWatcherOperator should inherit template_fields from DbtSourceLocalOperator + assert DbtSourceWatcherOperator.template_fields == DbtSourceLocalOperator.template_fields