-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathexample.py
More file actions
44 lines (37 loc) · 1.07 KB
/
example.py
File metadata and controls
44 lines (37 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from google.protobuf.duration_pb2 import Duration
from feast import Entity, Feature, FeatureView, FileSource, ValueType, FeatureService
generated_data_source = FileSource(
path="../../../generated_data.parquet",
event_timestamp_column="event_timestamp",
)
entity = Entity(
name="entity",
value_type=ValueType.INT64,
)
feature_views = [
FeatureView(
name=f"feature_view_{i}",
entities=["entity"],
ttl=Duration(seconds=86400),
features=[
Feature(name=f"feature_{10 * i + j}", dtype=ValueType.INT64)
for j in range(10)
],
online=True,
batch_source=generated_data_source,
)
for i in range(25)
]
feature_services = [
FeatureService(
name=f"feature_service_{i}",
features=feature_views[:5*(i + 1)],
)
for i in range(5)
]
def add_definitions_in_globals():
for i, fv in enumerate(feature_views):
globals()[f"feature_view_{i}"] = fv
for i, fs in enumerate(feature_services):
globals()[f"feature_service_{i}"] = fs
add_definitions_in_globals()