Skip to content

Commit 87f4463

Browse files
committed
address comments
Signed-off-by: pyalex <moskalenko.alexey@gmail.com>
1 parent 3808c6b commit 87f4463

4 files changed

Lines changed: 29 additions & 12 deletions

File tree

‎docs/getting-started/concepts/dataset.md‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# Dataset
22

3-
Feast Datasets allow for conveniently saving dataframes that include both features and entities to be subsequently used for data analysis and model training.
4-
[Data Quality Monitoring](https://docs.google.com/document/d/110F72d4NTv80p35wDSONxhhPBqWRwbZXG4f9mNEMd98) was the primary motivation for creating Dataset concept.
3+
Feast datasets allow for conveniently saving dataframes that include both features and entities to be subsequently used for data analysis and model training.
4+
[Data Quality Monitoring](https://docs.google.com/document/d/110F72d4NTv80p35wDSONxhhPBqWRwbZXG4f9mNEMd98) was the primary motivation for creating dataset concept.
55

6-
Dataset's metadata is stored in the Feast registry and dataframe with features, entities, additional input keys and timestamp is kept in the [offline store](../architecture-and-components/offline-store.md).
6+
Dataset's metadata is stored in the Feast registry and raw data (features, entities, additional input keys and timestamp) is stored in the [offline store](../architecture-and-components/offline-store.md).
77

88
Dataset can be created from:
99
1. Results of historical retrieval
10-
2. Logging request (including input for [on demand transformation](../../reference/alpha-on-demand-feature-view.md)) and response during feature serving
11-
3. Logging features during writing to online store (from batch source or stream)
10+
2. [planned] Logging request (including input for [on demand transformation](../../reference/alpha-on-demand-feature-view.md)) and response during feature serving
11+
3. [planned] Logging features during writing to online store (from batch source or stream)
1212

1313

1414
### Creating Saved Dataset from Historical Retrieval
1515

1616
To create a saved dataset from historical features for later retrieval or analysis, use the `save_as` parameter of `get_historical_features` method.
17-
If this parameter is supplied, Feast eagerly computes the DataFrame and stores the data using specified `storage`.
17+
If this parameter is supplied, Feast eagerly computes the dataframe and stores the data using specified `storage`.
1818
Any offline store can be used as such storage. Out of the box Feast supports BigQuery, Redshift and File storage (local, Google Storage or S3).
1919

2020
```python
@@ -30,7 +30,8 @@ store.get_historical_features(
3030
entity_df=...,
3131
save_as=SavedDatasetOptions(
3232
name='my_training_dataset',
33-
storage=SavedDatasetBigQueryStorage(table_ref='<gcp-project>.<gcp-dataset>.my_training_dataset')
33+
storage=SavedDatasetBigQueryStorage(table_ref='<gcp-project>.<gcp-dataset>.my_training_dataset'),
34+
tags={'author': 'oleksii'}
3435
)
3536
)
3637
```

‎protos/feast/core/SavedDataset.proto‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ message SavedDatasetSpec {
4343
bool full_feature_names = 5;
4444

4545
SavedDatasetStorage storage = 6;
46+
47+
// User defined metadata
48+
map<string, string> tags = 7;
4649
}
4750

4851
message SavedDatasetStorage {
@@ -54,16 +57,16 @@ message SavedDatasetStorage {
5457
}
5558

5659
message SavedDatasetMeta {
57-
// Time where this Saved Dataset is created
60+
// Time when this saved dataset is created
5861
google.protobuf.Timestamp created_timestamp = 1;
5962

60-
// Time where this Saved Dataset is last updated
63+
// Time when this saved dataset is last updated
6164
google.protobuf.Timestamp last_updated_timestamp = 2;
6265

63-
// min timestamp in the dataset (needed for retrieval)
66+
// Min timestamp in the dataset (needed for retrieval)
6467
google.protobuf.Timestamp min_event_timestamp = 3;
6568

66-
// max timestamp in the dataset (needed for retrieval)
69+
// Max timestamp in the dataset (needed for retrieval)
6770
google.protobuf.Timestamp max_event_timestamp = 4;
6871
}
6972

‎sdk/python/feast/saved_dataset.py‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class SavedDataset:
4747
join_keys: List[str]
4848
full_feature_names: bool
4949
storage: SavedDatasetStorage
50+
tags: Dict[str, str]
5051

5152
created_timestamp: Optional[datetime] = None
5253
last_updated_timestamp: Optional[datetime] = None
@@ -61,12 +62,14 @@ def __init__(
6162
join_keys: List[str],
6263
storage: SavedDatasetStorage,
6364
full_feature_names: bool = False,
65+
tags: Optional[Dict[str, str]] = None,
6466
):
6567
self.name = name
6668
self.features = features
6769
self.join_keys = join_keys
6870
self.storage = storage
6971
self.full_feature_names = full_feature_names
72+
self.tags = tags or {}
7073

7174
def __repr__(self):
7275
items = (f"{k} = {v}" for k, v in self.__dict__.items())
@@ -105,6 +108,7 @@ def from_proto(saved_dataset_proto: SavedDatasetProto):
105108
join_keys=list(saved_dataset_proto.spec.join_keys),
106109
full_feature_names=saved_dataset_proto.spec.full_feature_names,
107110
storage=SavedDatasetStorage.from_proto(saved_dataset_proto.spec.storage),
111+
tags=dict(saved_dataset_proto.spec.tags.items()),
108112
)
109113

110114
if saved_dataset_proto.meta.HasField("created_timestamp"):
@@ -147,6 +151,7 @@ def to_proto(self) -> SavedDatasetProto:
147151
join_keys=self.join_keys,
148152
full_feature_names=self.full_feature_names,
149153
storage=self.storage.to_proto(),
154+
tags=self.tags,
150155
)
151156

152157
feature_service_proto = SavedDatasetProto(spec=spec, meta=meta)
@@ -156,7 +161,14 @@ def to_proto(self) -> SavedDatasetProto:
156161
class SavedDatasetOptions:
157162
name: str
158163
storage: SavedDatasetStorage
164+
tags: Dict[str, str]
159165

160-
def __init__(self, name: str, storage: SavedDatasetStorage):
166+
def __init__(
167+
self,
168+
name: str,
169+
storage: SavedDatasetStorage,
170+
tags: Optional[Dict[str, str]] = None,
171+
):
161172
self.name = name
162173
self.storage = storage
174+
self.tags = tags or {}

‎sdk/python/tests/integration/offline_store/test_universal_historical_retrieval.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ def test_historical_features_persisting(
529529
saved_dataset_opts = SavedDatasetOptions(
530530
name="saved_dataset",
531531
storage=environment.data_source_creator.create_saved_dataset_destination(),
532+
tags={"env": "test"},
532533
)
533534

534535
entity_df = datasets["entity"].drop(

0 commit comments

Comments
 (0)