Skip to content

Commit 9823473

Browse files
committed
Merge source and source config freshness values before passing to SourceConfig
1 parent d11fcdd commit 9823473

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

sqlmesh/dbt/manifest.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from dbt.config.profile import read_profile
2222
from dbt.config.renderer import DbtProjectYamlRenderer, ProfileRenderer
2323
from dbt.parser.manifest import ManifestLoader
24+
from dbt.parser.sources import merge_freshness
2425
from dbt.tracking import do_not_track
2526

2627
from sqlmesh.core import constants as c
@@ -152,9 +153,18 @@ def _load_all(self) -> None:
152153

153154
def _load_sources(self) -> None:
154155
for source in self._manifest.sources.values():
156+
config_source = _config(source)
157+
source_dict = source.to_dict()
158+
159+
# starting in dbt-core 1.9.5, freshness can be set in both source and source config
160+
config_source_freshness = config_source.pop("freshness", None)
161+
source_dict_freshness = source_dict.pop("freshness", None)
162+
freshness = merge_freshness(source_dict_freshness, config_source_freshness)
163+
155164
source_config = SourceConfig(
156-
**_config(source),
157-
**source.to_dict(),
165+
**config_source,
166+
**source_dict,
167+
freshness=freshness,
158168
)
159169
self._sources_per_package[source.package_name][source_config.config_name] = (
160170
source_config

0 commit comments

Comments
 (0)