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: Support to apply Kafka Datasource in http registry #92

Merged
merged 1 commit into from
Mar 9, 2024
Merged
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
9 changes: 7 additions & 2 deletions sdk/python/feast/infra/registry/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from feast import usage
from feast.base_feature_view import BaseFeatureView
from feast.data_source import DataSource, PushSource, RequestSource
from feast.data_source import DataSource, KafkaSource, PushSource, RequestSource
from feast.entity import Entity
from feast.errors import (
DataSourceObjectNotFoundException,
Expand All @@ -21,6 +21,7 @@
ProjectMetadataNotFoundException,
)
from feast.expediagroup.pydantic_models.data_source_model import (
KafkaSourceModel,
PushSourceModel,
RequestSourceModel,
SparkSourceModel,
Expand Down Expand Up @@ -240,9 +241,13 @@ def apply_data_source(
data = PushSourceModel.from_data_source(data_source).json()
response_data = self._send_request("PUT", url, params=params, data=data)
return PushSourceModel.parse_obj(response_data).to_data_source()
elif isinstance(data_source, KafkaSource):
data = KafkaSourceModel.from_data_source(data_source).json()
response_data = self._send_request("PUT", url, params=params, data=data)
return KafkaSourceModel.parse_obj(response_data).to_data_source()
else:
raise TypeError(
"Unsupported DataSource type. Please use either SparkSource or RequestSource only"
"Unsupported DataSource type. Please use either SparkSource, RequestSource, PushSource or KafkaSource only"
)
except Exception as exception:
self._handle_exception(exception)
Expand Down
Loading