139139)
140140from sqlmesh .utils .config import print_config
141141from sqlmesh .utils .jinja import JinjaMacroRegistry
142+ from sqlmesh .utils .windows import IS_WINDOWS , fix_windows_path
142143
143144if t .TYPE_CHECKING :
144145 import pandas as pd
153154 )
154155 from sqlmesh .core .snapshot import Node
155156
157+ from sqlmesh .core .snapshot .definition import Intervals
158+
156159 ModelOrSnapshot = t .Union [str , Model , Snapshot ]
157160 NodeOrSnapshot = t .Union [str , Model , StandaloneAudit , Snapshot ]
158161
@@ -275,6 +278,7 @@ def __init__(
275278 default_dialect : t .Optional [str ] = None ,
276279 default_catalog : t .Optional [str ] = None ,
277280 is_restatement : t .Optional [bool ] = None ,
281+ parent_intervals : t .Optional [Intervals ] = None ,
278282 variables : t .Optional [t .Dict [str , t .Any ]] = None ,
279283 blueprint_variables : t .Optional [t .Dict [str , t .Any ]] = None ,
280284 ):
@@ -286,6 +290,7 @@ def __init__(
286290 self ._variables = variables or {}
287291 self ._blueprint_variables = blueprint_variables or {}
288292 self ._is_restatement = is_restatement
293+ self ._parent_intervals = parent_intervals
289294
290295 @property
291296 def default_dialect (self ) -> t .Optional [str ]:
@@ -314,6 +319,10 @@ def gateway(self) -> t.Optional[str]:
314319 def is_restatement (self ) -> t .Optional [bool ]:
315320 return self ._is_restatement
316321
322+ @property
323+ def parent_intervals (self ) -> t .Optional [Intervals ]:
324+ return self ._parent_intervals
325+
317326 def var (self , var_name : str , default : t .Optional [t .Any ] = None ) -> t .Optional [t .Any ]:
318327 """Returns a variable value."""
319328 return self ._variables .get (var_name .lower (), default )
@@ -2590,12 +2599,15 @@ def table_name(
25902599 )
25912600
25922601 def clear_caches (self ) -> None :
2593- for path in self .configs :
2594- cache_path = path / c .CACHE
2595- if cache_path .exists ():
2596- rmtree (cache_path )
2597- if self .cache_dir .exists ():
2598- rmtree (self .cache_dir )
2602+ paths_to_remove = [path / c .CACHE for path in self .configs ]
2603+ paths_to_remove .append (self .cache_dir )
2604+
2605+ if IS_WINDOWS :
2606+ paths_to_remove = [fix_windows_path (path ) for path in paths_to_remove ]
2607+
2608+ for path in paths_to_remove :
2609+ if path .exists ():
2610+ rmtree (path )
25992611
26002612 if isinstance (self ._state_sync , CachingStateSync ):
26012613 self ._state_sync .clear_cache ()
0 commit comments