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

fix: Do not allow same column to be reused in data sources #2965

Merged
merged 2 commits into from
Jul 21, 2022
Merged
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
7 changes: 7 additions & 0 deletions sdk/python/feast/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,13 @@ def __init__(
),
DeprecationWarning,
)
if (
self.timestamp_field
and self.timestamp_field == self.created_timestamp_column
):
raise ValueError(
"Please do not use the same column for 'timestamp_field' and 'created_timestamp_column'."
)
self.description = description or ""
self.tags = tags or {}
self.owner = owner or ""
Expand Down
10 changes: 10 additions & 0 deletions sdk/python/tests/unit/test_data_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,13 @@ def test_proto_conversion():
assert DataSource.from_proto(kinesis_source.to_proto()) == kinesis_source
assert DataSource.from_proto(push_source.to_proto()) == push_source
assert DataSource.from_proto(request_source.to_proto()) == request_source


def test_column_conflict():
with pytest.raises(ValueError):
_ = FileSource(
name="test_source",
path="test_path",
timestamp_field="event_timestamp",
created_timestamp_column="event_timestamp",
)