Skip to content

Commit

Permalink
fix: Support to apply Kafka Datasource in http registry (#92)
Browse files Browse the repository at this point in the history
Co-authored-by: Bhargav Dodla <[email protected]>
  • Loading branch information
EXPEbdodla and Bhargav Dodla authored Mar 9, 2024
1 parent f1a1571 commit 32779b1
Showing 1 changed file with 7 additions and 2 deletions.
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

0 comments on commit 32779b1

Please sign in to comment.