Skip to content

Commit b474cca

Browse files
authored
Fix: floor yesterday to a date to prevent it from being later than start (#705)
this can happen if no snapshots have start date, so we default to yesterday(), but end_date defaults to yesterday_ds()
1 parent 008635d commit b474cca

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sqlmesh/core/scheduler.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,10 @@ def earliest_start_date(snapshots: t.Iterable[Snapshot]) -> datetime:
374374
The earliest start date or yesterday if none is found.
375375
"""
376376
snapshots = list(snapshots)
377+
earliest = to_datetime(yesterday().date())
377378
if snapshots:
378-
return min(start_date(snapshot, snapshots) or yesterday() for snapshot in snapshots)
379-
return yesterday()
379+
return min(start_date(snapshot, snapshots) or earliest for snapshot in snapshots)
380+
return earliest
380381

381382

382383
def _batched_intervals(params: SnapshotToBatches) -> SnapshotToBatches:

0 commit comments

Comments
 (0)