Register objects to metadata store and update related infrastructure. The apply method registers one or more definitions (e.g., Entity, FeatureView) and registers or updates these objects in the Feast registry. Once the apply method has updated the infrastructure (e.g., create table
(
self,
objects: Union[
Project,
DataSource,
Entity,
FeatureView,
OnDemandFeatureView,
BatchFeatureView,
StreamFeatureView,
LabelView,
FeatureService,
ValidationReference,
Permission,
List[FeastObject],
],
objects_to_delete: Optional[List[FeastObject]] = None,
partial: bool = True,
skip_feature_view_validation: bool = False,
no_promote: bool = False,
)
| 1331 | self._emit_openlineage_apply(objects) |
| 1332 | |
| 1333 | def apply( |
| 1334 | self, |
| 1335 | objects: Union[ |
| 1336 | Project, |
| 1337 | DataSource, |
| 1338 | Entity, |
| 1339 | FeatureView, |
| 1340 | OnDemandFeatureView, |
| 1341 | BatchFeatureView, |
| 1342 | StreamFeatureView, |
| 1343 | LabelView, |
| 1344 | FeatureService, |
| 1345 | ValidationReference, |
| 1346 | Permission, |
| 1347 | List[FeastObject], |
| 1348 | ], |
| 1349 | objects_to_delete: Optional[List[FeastObject]] = None, |
| 1350 | partial: bool = True, |
| 1351 | skip_feature_view_validation: bool = False, |
| 1352 | no_promote: bool = False, |
| 1353 | ): |
| 1354 | """Register objects to metadata store and update related infrastructure. |
| 1355 | |
| 1356 | The apply method registers one or more definitions (e.g., Entity, FeatureView) and registers or updates these |
| 1357 | objects in the Feast registry. Once the apply method has updated the infrastructure (e.g., create tables in |
| 1358 | an online store), it will commit the updated registry. All operations are idempotent, meaning they can safely |
| 1359 | be rerun. |
| 1360 | |
| 1361 | Note: The apply method does NOT delete objects that are removed from the provided list. To delete objects |
| 1362 | from the registry, use explicit delete methods like delete_feature_view(), delete_feature_service(), or |
| 1363 | pass objects to the objects_to_delete parameter with partial=False. |
| 1364 | |
| 1365 | Args: |
| 1366 | objects: A single object, or a list of objects that should be registered with the Feature Store. |
| 1367 | objects_to_delete: A list of objects to be deleted from the registry and removed from the |
| 1368 | provider's infrastructure. This deletion will only be performed if partial is set to False. |
| 1369 | partial: If True, apply will only handle the specified objects; if False, apply will also delete |
| 1370 | all the objects in objects_to_delete, and tear down any associated cloud resources. |
| 1371 | skip_feature_view_validation: If True, skip validation of feature views. This can be useful when the validation |
| 1372 | system is being overly strict. Use with caution and report any issues on GitHub. Default is False. |
| 1373 | |
| 1374 | Raises: |
| 1375 | ValueError: The 'objects' parameter could not be parsed properly. |
| 1376 | |
| 1377 | Examples: |
| 1378 | Register an Entity and a FeatureView. |
| 1379 | |
| 1380 | >>> from feast import FeatureStore, Entity, FeatureView, Feature, FileSource, RepoConfig |
| 1381 | >>> from datetime import timedelta |
| 1382 | >>> fs = FeatureStore(repo_path="project/feature_repo") |
| 1383 | >>> driver = Entity(name="driver_id", description="driver id") |
| 1384 | >>> driver_hourly_stats = FileSource( |
| 1385 | ... path="data/driver_stats.parquet", |
| 1386 | ... timestamp_field="event_timestamp", |
| 1387 | ... created_timestamp_column="created", |
| 1388 | ... ) |
| 1389 | >>> driver_hourly_stats_view = FeatureView( |
| 1390 | ... name="driver_hourly_stats", |