-
Notifications
You must be signed in to change notification settings - Fork 999
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Parse inline data sources (#3036)
* Remove deprecated CLI warnings Signed-off-by: Felix Wang <[email protected]> * Fix repo parsing logic Signed-off-by: Felix Wang <[email protected]> * Add tests Signed-off-by: Felix Wang <[email protected]> Signed-off-by: Felix Wang <[email protected]>
- Loading branch information
1 parent
66d2c76
commit c7ba370
Showing
9 changed files
with
437 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
sdk/python/tests/example_repos/example_feature_repo_with_inline_batch_source.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from datetime import timedelta | ||
|
||
from feast import Entity, FeatureView, Field, FileSource | ||
from feast.types import Float32, Int32, Int64 | ||
|
||
driver = Entity( | ||
name="driver_id", | ||
description="driver id", | ||
) | ||
|
||
driver_hourly_stats_view = FeatureView( | ||
name="driver_hourly_stats", | ||
entities=[driver], | ||
ttl=timedelta(days=1), | ||
schema=[ | ||
Field(name="conv_rate", dtype=Float32), | ||
Field(name="acc_rate", dtype=Float32), | ||
Field(name="avg_daily_trips", dtype=Int64), | ||
Field(name="driver_id", dtype=Int32), | ||
], | ||
online=True, | ||
source=FileSource( | ||
path="data/driver_stats.parquet", # Fake path | ||
timestamp_field="event_timestamp", | ||
created_timestamp_column="created", | ||
), | ||
tags={}, | ||
) |
37 changes: 37 additions & 0 deletions
37
sdk/python/tests/example_repos/example_feature_repo_with_inline_stream_source.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from datetime import timedelta | ||
|
||
from feast import Entity, FeatureView, Field, FileSource, KafkaSource | ||
from feast.data_format import AvroFormat | ||
from feast.types import Float32, Int32, Int64 | ||
|
||
driver = Entity( | ||
name="driver_id", | ||
description="driver id", | ||
) | ||
|
||
driver_hourly_stats_view = FeatureView( | ||
name="driver_hourly_stats", | ||
entities=[driver], | ||
ttl=timedelta(days=1), | ||
schema=[ | ||
Field(name="conv_rate", dtype=Float32), | ||
Field(name="acc_rate", dtype=Float32), | ||
Field(name="avg_daily_trips", dtype=Int64), | ||
Field(name="driver_id", dtype=Int32), | ||
], | ||
online=True, | ||
source=KafkaSource( | ||
name="kafka", | ||
timestamp_field="event_timestamp", | ||
kafka_bootstrap_servers="", | ||
message_format=AvroFormat(""), | ||
topic="topic", | ||
batch_source=FileSource( | ||
path="data/driver_stats.parquet", # Fake path | ||
timestamp_field="event_timestamp", | ||
created_timestamp_column="created", | ||
), | ||
watermark_delay_threshold=timedelta(days=1), | ||
), | ||
tags={}, | ||
) |
18 changes: 18 additions & 0 deletions
18
sdk/python/tests/example_repos/example_feature_repo_with_stream_source.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from datetime import timedelta | ||
|
||
from feast import FileSource, KafkaSource | ||
from feast.data_format import AvroFormat | ||
|
||
stream_source = KafkaSource( | ||
name="kafka", | ||
timestamp_field="event_timestamp", | ||
kafka_bootstrap_servers="", | ||
message_format=AvroFormat(""), | ||
topic="topic", | ||
batch_source=FileSource( | ||
path="data/driver_stats.parquet", # Fake path | ||
timestamp_field="event_timestamp", | ||
created_timestamp_column="created", | ||
), | ||
watermark_delay_threshold=timedelta(days=1), | ||
) |
Oops, something went wrong.