Skip to content

featurebyte.FeatureList.create_new_version

create_new_version(
features: Union[List[FeatureVersionInfo], NoneType]=None
) -> FeatureList

Description

Creates a new feature version from a FeatureList object. The current default version of the features within the feature list is employed to create the new version, except when specific versions are indicated by the feature's parameter.

Parameters

  • features: Union[List[FeatureVersionInfo], NoneType]
    List specific feature versions that must be used in the new FeatureList object instead of the default version. Each feature version in the list is defined by using the FeatureVersionInfo constructor that takes as input the feature name and the version.

Returns

  • FeatureList
    Newly created feature list with the specified features or the latest default versions of features.

Raises

  • RecordCreationException
    When failed to save a new version, e.g. when the created feature list is exactly the same as the current one. Another reason could be that the specified feature in features parameter does not exist.

Examples

Retrieve feature list & check its features.

>>> feature_list = catalog.get_feature_list("invoice_feature_list")
>>> feature_list.list_features()[["name", "version"]]
                  name  version
0  InvoiceCount_60days  V230330
Create a new feature by specifying the table name and feature job settings. Then set the newly created feature as default.

>>> current_feature = feature_list["InvoiceCount_60days"]
>>> new_feature = current_feature.create_new_version(
...   table_feature_job_settings=[
...     fb.TableFeatureJobSetting(
...       table_name="GROCERYINVOICE",
...       feature_job_setting=fb.FeatureJobSetting(
...         blind_spot="60s",
...         frequency="3600s",
...         time_modulo_frequency="90s",
...       )
...     )
...   ]
... )

>>> current_feature.update_readiness("DEPRECATED")
>>> new_feature.update_default_version_mode("MANUAL")
>>> new_feature.as_default_version()
>>> new_feature.is_default is True and current_feature.is_default is False
True
Create new version of feature list without specifying feature (uses the current default versions of feature).

>>> new_feature_list = feature_list.create_new_version()
>>> new_feature_list.list_features()[["name", "version"]]
                  name    version
0  InvoiceCount_60days  V230330_1
Create new version of feature list by specifying feature:

>>> new_feature_list = feature_list.create_new_version(
...   features=[fb.FeatureVersionInfo(name="InvoiceCount_60days", version=new_feature.version)]
... )
Reset the default version mode of the feature to make original feature as default. Create a new version of feature list using original feature list without changing any feature will return the same feature list.

>>> current_feature.update_readiness("PRODUCTION_READY")
>>> current_feature.update_default_version_mode("AUTO")
>>> current_feature.is_default
True
>>> same_feature_list = feature_list.create_new_version()
>>> same_feature_list.id == feature_list.id
True

See Also