Skip to content

Commit 0d1ac01

Browse files
authored
fix: Fix Feast UI failure with new way of specifying entities (#2773)
* fix: Fix Feast UI failure with new way of specifying entities Signed-off-by: Danny Chiao <[email protected]> * fix: Fix Feast UI failure with new way of specifying entities Signed-off-by: Danny Chiao <[email protected]>
1 parent ecb8b2a commit 0d1ac01

File tree

3 files changed

+11
-23
lines changed

3 files changed

+11
-23
lines changed

ui/feature_repo/features.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
from datetime import timedelta
22

3-
from feast import (
4-
Entity,
5-
FeatureService,
6-
FeatureView,
7-
Field,
8-
FileSource,
9-
ValueType,
10-
)
3+
import pandas as pd
4+
5+
from feast import Entity, FeatureService, FeatureView, Field, FileSource, ValueType
116
from feast.data_source import RequestSource
12-
from feast.request_feature_view import RequestFeatureView
137
from feast.on_demand_feature_view import on_demand_feature_view
148
from feast.types import Bool, Int64, String
15-
import pandas as pd
169

1710
zipcode = Entity(
1811
name="zipcode",
@@ -128,19 +121,14 @@
128121
# Define a request data source which encodes features / information only
129122
# available at request time (e.g. part of the user initiated HTTP request)
130123
input_request = RequestSource(
131-
name="transaction",
132-
schema=[
133-
Field(name="transaction_amt", dtype=Int64),
134-
],
124+
name="transaction", schema=[Field(name="transaction_amt", dtype=Int64),],
135125
)
136126

137127
# Define an on demand feature view which can generate new features based on
138128
# existing feature views and RequestSource features
139129
@on_demand_feature_view(
140130
sources=[credit_history, input_request],
141-
schema=[
142-
Field(name="transaction_gt_last_credit_card_due", dtype=Bool),
143-
],
131+
schema=[Field(name="transaction_gt_last_credit_card_due", dtype=Bool),],
144132
)
145133
def transaction_gt_last_credit_card_due(inputs: pd.DataFrame) -> pd.DataFrame:
146134
df = pd.DataFrame()
@@ -149,6 +137,7 @@ def transaction_gt_last_credit_card_due(inputs: pd.DataFrame) -> pd.DataFrame:
149137
)
150138
return df
151139

140+
152141
model_v1 = FeatureService(
153142
name="credit_score_v1",
154143
features=[

ui/feature_repo/test_get_features.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import pandas as pd
2-
from feast import FeatureStore
3-
from feast.infra.offline_stores.file import SavedDatasetFileStorage
4-
5-
from feast.dqm.profilers.ge_profiler import ge_profiler
6-
72
from great_expectations.core.expectation_suite import ExpectationSuite
83
from great_expectations.dataset import PandasDataset
94

5+
from feast import FeatureStore
6+
from feast.dqm.profilers.ge_profiler import ge_profiler
7+
from feast.infra.offline_stores.file import SavedDatasetFileStorage
8+
109
DELTA = 0.1 # controlling allowed window in fraction of the value on scale [0, 1]
1110
# Note: the GE integration allows asserting differences between datasets. The "ds" below is the reference dataset to check and this generates the expectation suite which can be used against future datasets.
1211
# It's used via ge.validate(new_dataset, ExpectationSuite)

ui/src/parsers/feastEntities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { FEAST_FEATURE_VALUE_TYPES } from "./types";
44
const FeastEntitySchema = z.object({
55
spec: z.object({
66
name: z.string(),
7-
valueType: z.nativeEnum(FEAST_FEATURE_VALUE_TYPES),
7+
valueType: z.nativeEnum(FEAST_FEATURE_VALUE_TYPES).optional(),
88
joinKey: z.string(),
99
description: z.string().optional(),
1010
labels: z.record(z.string()).optional(),

0 commit comments

Comments
 (0)