Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -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)
----------------------

Expand Down
2 changes: 1 addition & 1 deletion cosmos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion cosmos/operators/watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
13 changes: 13 additions & 0 deletions tests/operators/test_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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