@@ -286,6 +286,66 @@ def test_missing_intervals_partial(make_snapshot):
286286 (to_timestamp (start ), to_timestamp ("2023-01-02" )),
287287 ]
288288 assert snapshot .missing_intervals (start , start , execution_time = start , ignore_cron = True ) == []
289+ assert snapshot .missing_intervals (start , start , execution_time = end_ts , end_bounded = True ) == []
290+
291+
292+ def test_missing_intervals_end_bounded_with_lookback (make_snapshot ):
293+ snapshot = make_snapshot (
294+ SqlModel (
295+ name = "test_model" ,
296+ kind = IncrementalByTimeRangeKind (time_column = TimeColumn (column = "ds" ), lookback = 1 ),
297+ owner = "owner" ,
298+ cron = "@daily" ,
299+ query = parse_one ("SELECT 1, ds FROM name" ),
300+ )
301+ )
302+
303+ start = "2023-01-01"
304+ end = "2023-01-02"
305+
306+ snapshot .intervals = [(to_timestamp (start ), to_timestamp (end ))]
307+
308+ execution_ts = to_timestamp ("2023-01-03" )
309+ assert snapshot .missing_intervals (start , start , execution_time = execution_ts ) == [
310+ (to_timestamp (start ), to_timestamp (end )),
311+ ]
312+ assert (
313+ snapshot .missing_intervals (start , start , execution_time = execution_ts , end_bounded = True )
314+ == []
315+ )
316+
317+
318+ def test_missing_intervals_end_bounded_with_ignore_cron (make_snapshot ):
319+ snapshot = make_snapshot (
320+ SqlModel (
321+ name = "test_model" ,
322+ kind = IncrementalByTimeRangeKind (time_column = TimeColumn (column = "ds" )),
323+ owner = "owner" ,
324+ cron = "1 0 * * *" ,
325+ query = parse_one ("SELECT 1, ds FROM name" ),
326+ )
327+ )
328+
329+ start = "2023-01-01"
330+ end = "2023-01-03"
331+
332+ snapshot .intervals = [(to_timestamp (start ), to_timestamp ("2023-01-02" ))]
333+
334+ execution_ts = to_timestamp (end )
335+ assert snapshot .missing_intervals (start , end , execution_time = execution_ts ) == []
336+ assert snapshot .missing_intervals (
337+ start , end , execution_time = execution_ts , ignore_cron = True
338+ ) == [
339+ (to_timestamp ("2023-01-02" ), to_timestamp (end )),
340+ ]
341+ assert (
342+ snapshot .missing_intervals (start , end , execution_time = execution_ts , end_bounded = True ) == []
343+ )
344+ assert snapshot .missing_intervals (
345+ start , end , execution_time = execution_ts , ignore_cron = True , end_bounded = True
346+ ) == [
347+ (to_timestamp ("2023-01-02" ), to_timestamp (end )),
348+ ]
289349
290350
291351def test_incremental_time_self_reference (make_snapshot ):
0 commit comments