Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuring the format of EventTimeFilter #11376

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/unreleased/Features-20250308-193830.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Features
body: Allow configuring the format of EventTimeFilter
time: 2025-03-08T19:38:30.907199+09:00
custom:
Author: logicoffee
Issue: "11331"
1 change: 1 addition & 0 deletions core/dbt/artifacts/resources/v1/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class NodeConfig(NodeAndTestConfig):
metadata=MergeBehavior.Update.meta(),
)
event_time: Any = None
event_time_filter_format: Any = None
concurrent_batches: Any = None

def __post_init__(self):
Expand Down
1 change: 1 addition & 0 deletions core/dbt/artifacts/resources/v1/source_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
class SourceConfig(BaseConfig):
enabled: bool = True
event_time: Any = None
event_time_filter_format: Any = None


@dataclass
Expand Down
4 changes: 3 additions & 1 deletion core/dbt/context/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ def resolve_event_time_filter(self, target: ManifestNode) -> Optional[EventTimeF
and target.config.event_time
and isinstance(self.model, (ModelNode, SnapshotNode))
):

# Handling of microbatch models
if (
isinstance(self.model, ModelNode)
Expand All @@ -281,6 +280,7 @@ def resolve_event_time_filter(self, target: ManifestNode) -> Optional[EventTimeF
)
event_time_filter = EventTimeFilter(
field_name=target.config.event_time,
filter_format=target.config.event_time_filter_format,
start=start,
end=end,
)
Expand All @@ -289,6 +289,7 @@ def resolve_event_time_filter(self, target: ManifestNode) -> Optional[EventTimeF
else:
event_time_filter = EventTimeFilter(
field_name=target.config.event_time,
filter_format=target.config.event_time_filter_format,
start=self.model.batch.event_time_start,
end=self.model.batch.event_time_end,
)
Expand All @@ -297,6 +298,7 @@ def resolve_event_time_filter(self, target: ManifestNode) -> Optional[EventTimeF
elif sample_mode:
event_time_filter = EventTimeFilter(
field_name=target.config.event_time,
filter_format=target.config.event_time_filter_format,
start=self.config.args.sample.start,
end=self.config.args.sample.end,
)
Expand Down
Loading