Skip to content

Commit d152d2d

Browse files
committed
Fix: Support of recursive symlinks in dbt project folders
1 parent 5bb40a1 commit d152d2d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

sqlmesh/dbt/loader.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,17 +293,25 @@ def _load_environment_statements(self, macros: MacroRegistry) -> t.List[Environm
293293
)
294294
]
295295

296-
def _compute_yaml_max_mtime_per_subfolder(self, root: Path) -> t.Dict[Path, float]:
297-
if not root.is_dir():
296+
def _compute_yaml_max_mtime_per_subfolder(
297+
self, root: Path, visited: t.Optional[t.Set[Path]] = None
298+
) -> t.Dict[Path, float]:
299+
root = root.resolve()
300+
visited = visited or set()
301+
if not root.is_dir() or root in visited:
298302
return {}
299303

304+
visited.add(root)
305+
300306
result = {}
301307
max_mtime: t.Optional[float] = None
302308

303309
for nested in root.iterdir():
304310
try:
305311
if nested.is_dir():
306-
result.update(self._compute_yaml_max_mtime_per_subfolder(nested))
312+
result.update(
313+
self._compute_yaml_max_mtime_per_subfolder(nested, visited=visited)
314+
)
307315
elif nested.suffix.lower() in (".yaml", ".yml"):
308316
yaml_mtime = self._path_mtimes.get(nested)
309317
if yaml_mtime:

0 commit comments

Comments
 (0)