You can use apply() to modify an existing component:
- Get the corresponding component.
- Modify the corresponding component's property.
- Pass the same component again to apply().
Usage
- Do not not modify name of any component. If you modify name and push it to FeatureStore, a new component will get created with that name.
- You can modify multiple properties of a component and add it back to FeatureStore once all the modifications are done.
- If you get a FeatureGroup, you can modify the underlying Features, Entity, or DataSource. If you push FeatureGroup after modification, then underlying Features, Entity, or DataSource will also get modified.
Example: Modify a Feature
Get the feature 'sales_mar' from repo 'vfs_v1', modify the description, and update it to FeatureStore.
>>> feature = fs.get_feature('sales_mar')
>>> feature.description 'Feature of sales.' >>>
>>> feature.description = 'Feature for March sales.'
>>> fs.apply(feature) True
>>> fs.get_feature('sales_mar').description 'Feature for March sales.'
Example: Modify a FeatureGroup and underlying DataSource
Get the FeatureGroup with group name 'sales' from repo 'vfs_v1'.
>>> fg = fs.get_feature_group('sales')
Update the FeatureGroup description.
>>> fg.description = 'Sales Group'
Update the associated DataSource description.
>>> fg.data_source.description = 'sales data source.'
Update the details to repo.
>>> fs.apply(fg) True
Verify the updated details.
>>> fg = fs.get_feature_group('sales')
>>> fg.description 'Sales Group'
>>> fg.data_source.description 'sales data source.'