Skip to content

Commit

Permalink
Rename batch_current_time to default_end_time for MicrobatchBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
QMalcolm committed Oct 7, 2024
1 parent 5f496c2 commit 9cd6cea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions core/dbt/materializations/incremental/microbatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(
is_incremental: bool,
event_time_start: Optional[datetime],
event_time_end: Optional[datetime],
batch_current_time: Optional[datetime] = None,
default_end_time: Optional[datetime] = None,
):
if model.config.incremental_strategy != "microbatch":
raise DbtInternalError(
Expand All @@ -36,11 +36,11 @@ def __init__(
event_time_start.replace(tzinfo=pytz.UTC) if event_time_start else None
)
self.event_time_end = event_time_end.replace(tzinfo=pytz.UTC) if event_time_end else None
self.batch_current_time = batch_current_time or datetime.now(pytz.UTC)
self.default_end_time = default_end_time or datetime.now(pytz.UTC)

def build_end_time(self):
"""Defaults the end_time to the current time in UTC unless a non `None` event_time_end was provided"""
return self.event_time_end or self.batch_current_time
return self.event_time_end or self.default_end_time

def build_start_time(self, checkpoint: Optional[datetime]):
"""Create a start time based off the passed in checkpoint.
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/task/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ def _execute_microbatch_materialization(
is_incremental=self._is_incremental(model),
event_time_start=getattr(self.config.args, "EVENT_TIME_START", None),
event_time_end=getattr(self.config.args, "EVENT_TIME_END", None),
batch_current_time=self.config.invoked_at,
default_end_time=self.config.invoked_at,
)
end = microbatch_builder.build_end_time()
start = microbatch_builder.build_start_time(end)
Expand Down

0 comments on commit 9cd6cea

Please sign in to comment.