Skip to content

Commit f7f5373

Browse files
authored
Simplify logic (#11678)
1 parent 32b8097 commit f7f5373

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
kind: Under the Hood
2+
body: Prevent overcounting PropertyMovedToConfigDeprecation for source freshness
3+
time: 2025-05-27T16:21:36.551426+01:00
4+
custom:
5+
Author: aranke
6+
Issue: "11660"

core/dbt/parser/sources.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def __init__(
5454
self.generic_test_parsers: Dict[str, SchemaGenericTestParser] = {}
5555
self.patches_used: Dict[SourceKey, Set[str]] = {}
5656
self.sources: Dict[str, SourceDefinition] = {}
57+
self._deprecations: Set[Any] = set()
5758

5859
# This method calls the 'parse_source' method which takes
5960
# the UnpatchedSourceDefinitions in the manifest and combines them
@@ -169,24 +170,26 @@ def parse_source(self, target: UnpatchedSourceDefinition) -> SourceDefinition:
169170
project_freshness = None
170171

171172
source_freshness = source.freshness
172-
if source_freshness:
173+
if source_freshness and (target.path, source.name) not in self._deprecations:
173174
deprecations.warn(
174175
"property-moved-to-config-deprecation",
175176
key="freshness",
176177
file=target.path,
177178
key_path=source.name,
178179
)
180+
self._deprecations.add((target.path, source.name))
179181

180182
source_config_freshness = FreshnessThreshold.from_dict(source.config.get("freshness", {}))
181183

182184
table_freshness = table.freshness
183-
if table_freshness:
185+
if table_freshness and (target.path, table.name) not in self._deprecations:
184186
deprecations.warn(
185187
"property-moved-to-config-deprecation",
186188
key="freshness",
187189
file=target.path,
188190
key_path=table.name,
189191
)
192+
self._deprecations.add((target.path, table.name))
190193

191194
table_config_freshness = FreshnessThreshold.from_dict(table.config.get("freshness", {}))
192195
freshness = merge_source_freshness(

0 commit comments

Comments
 (0)