|
13 | 13 | # limitations under the License. |
14 | 14 | from datetime import datetime |
15 | 15 | from pathlib import Path |
16 | | -from typing import Dict, List, Optional, Tuple, Type, Union |
| 16 | +from typing import Dict, List, Optional, Tuple, Union |
17 | 17 |
|
18 | 18 | import pandas as pd |
19 | 19 | import pyarrow |
|
23 | 23 | from feast.feature_view import FeatureView |
24 | 24 | from feast.infra.provider import Provider, get_provider |
25 | 25 | from feast.offline_store import ( |
26 | | - OfflineStore, |
27 | 26 | RetrievalJob, |
28 | 27 | get_offline_store, |
29 | 28 | get_offline_store_for_retrieval, |
@@ -69,9 +68,6 @@ def __init__( |
69 | 68 | def _get_provider(self) -> Provider: |
70 | 69 | return get_provider(self.config) |
71 | 70 |
|
72 | | - def _get_offline_store(self) -> Type[OfflineStore]: |
73 | | - return get_offline_store(self.config) |
74 | | - |
75 | 71 | def _get_registry(self) -> Registry: |
76 | 72 | return Registry(self.config.metadata_store) |
77 | 73 |
|
@@ -183,8 +179,20 @@ def materialize( |
183 | 179 | Args: |
184 | 180 | feature_views (List[str]): Optional list of feature view names. If selected, will only run |
185 | 181 | materialization for the specified feature views. |
186 | | - start_date (datetime): Start date of query |
187 | | - end_date (datetime): End date of query |
| 182 | + start_date (datetime): Start date for time range of data to materialize into the online store |
| 183 | + end_date (datetime): End date for time range of data to materialize into the online store |
| 184 | +
|
| 185 | + Examples: |
| 186 | + Materialize all features into the online store over the interval |
| 187 | + from 3 hours ago to 10 minutes ago. |
| 188 | + >>> from datetime import datetime, timedelta |
| 189 | + >>> from feast.feature_store import FeatureStore |
| 190 | + >>> |
| 191 | + >>> fs = FeatureStore(config=RepoConfig(provider="gcp")) |
| 192 | + >>> fs.materialize( |
| 193 | + >>> start_date=datetime.utcnow() - timedelta(hours=3), |
| 194 | + >>> end_date=datetime.utcnow() - timedelta(minutes=10) |
| 195 | + >>> ) |
188 | 196 | """ |
189 | 197 | feature_views_to_materialize = [] |
190 | 198 | registry = self._get_registry() |
@@ -214,7 +222,7 @@ def materialize( |
214 | 222 | created_timestamp_column, |
215 | 223 | ) = _run_reverse_field_mapping(feature_view) |
216 | 224 |
|
217 | | - offline_store = self._get_offline_store() |
| 225 | + offline_store = get_offline_store(self.config) |
218 | 226 | table = offline_store.pull_latest_from_table( |
219 | 227 | feature_view.input, |
220 | 228 | entity_names, |
|
0 commit comments