From 0d60eaa0b7f32c84eb015c814a3c879e7d4f50fd Mon Sep 17 00:00:00 2001 From: Achal Shah Date: Mon, 16 May 2022 12:25:47 -0700 Subject: [PATCH] fix: Support push sources in stream feature views (#2704) Signed-off-by: Achal Shah --- sdk/python/feast/stream_feature_view.py | 5 +---- sdk/python/tests/unit/test_feature_views.py | 13 ++++++++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/sdk/python/feast/stream_feature_view.py b/sdk/python/feast/stream_feature_view.py index 1c51b94a7c..cfb3f63d7d 100644 --- a/sdk/python/feast/stream_feature_view.py +++ b/sdk/python/feast/stream_feature_view.py @@ -7,10 +7,7 @@ from feast.field import Field from feast.protos.feast.core.DataSource_pb2 import DataSource as DataSourceProto -SUPPORTED_STREAM_SOURCES = { - "KafkaSource", - "KinesisSource", -} +SUPPORTED_STREAM_SOURCES = {"KafkaSource", "KinesisSource", "PushSource"} class StreamFeatureView(FeatureView): diff --git a/sdk/python/tests/unit/test_feature_views.py b/sdk/python/tests/unit/test_feature_views.py index 8708a983c4..f72ae4fe9c 100644 --- a/sdk/python/tests/unit/test_feature_views.py +++ b/sdk/python/tests/unit/test_feature_views.py @@ -2,6 +2,7 @@ import pytest +from feast import PushSource from feast.batch_feature_view import BatchFeatureView from feast.data_format import AvroFormat from feast.data_source import KafkaSource @@ -50,12 +51,22 @@ def test_create_stream_feature_view(): batch_source=FileSource(path="some path"), ) StreamFeatureView( - name="test batch feature view", + name="test kafka stream feature view", entities=[], ttl=timedelta(days=30), source=stream_source, ) + push_source = PushSource( + name="push source", batch_source=FileSource(path="some path") + ) + StreamFeatureView( + name="test push source feature view", + entities=[], + ttl=timedelta(days=30), + source=push_source, + ) + with pytest.raises(ValueError): StreamFeatureView( name="test batch feature view", entities=[], ttl=timedelta(days=30)