snowflake.ml.feature_store.FeatureView¶
- class snowflake.ml.feature_store.FeatureView(name: str, entities: List[Entity], feature_df: DataFrame, *, timestamp_col: Optional[str] = None, refresh_freq: Optional[str] = None, desc: str = '', warehouse: Optional[str] = None, **_kwargs: Any)¶
Bases:
LineageNode
A FeatureView instance encapsulates a logical group of features.
Create a FeatureView instance.
- Parameters:
name – name of the FeatureView. NOTE: following Snowflake identifier rule
entities – entities that the FeatureView is associated with.
feature_df – Snowpark DataFrame containing data source and all feature feature_df logics. Final projection of the DataFrame should contain feature names, join keys and timestamp(if applicable).
timestamp_col – name of the timestamp column for point-in-time lookup when consuming the feature values.
refresh_freq –
Time unit defining how often the new feature data should be generated. Valid args are { <num> { seconds | minutes | hours | days } | DOWNSTREAM | <cron expr> <time zone>}. NOTE: Currently minimum refresh frequency is 1 minute. NOTE: If refresh_freq is in cron expression format, there must be a valid time zone as well.
E.g. * * * * * UTC
- NOTE: If refresh_freq is not provided, then FeatureView will be registered as View on Snowflake backend
and there won’t be extra storage cost.
desc – description of the FeatureView.
warehouse – warehouse to refresh feature view. Not needed for static feature view (refresh_freq is None). For managed feature view, this warehouse will overwrite the default warehouse of Feature Store if it is specified, otherwise the default warehouse will be used.
_kwargs – reserved kwargs for system generated args. NOTE: DO NOT USE.
Methods
- attach_feature_desc(descs: Dict[str, str]) FeatureView ¶
Associate feature level descriptions to the FeatureView.
- Parameters:
descs – Dictionary contains feature name and corresponding descriptions.
- Returns:
FeatureView with feature level desc attached.
- Raises:
ValueError – if feature name is not found in the FeatureView.
- classmethod from_json(json_str: str, session: Session) FeatureView ¶
- fully_qualified_name() str ¶
- Returns the fully qualified name (<database_name>.<schema_name>.<feature_view_name>) for the
FeatureView in Snowflake.
- Returns:
fully qualified name string.
- Raises:
RuntimeError – if the FeatureView is not registered.
- lineage(direction: Literal['upstream', 'downstream'] = 'downstream', domain_filter: Optional[Set[Literal['feature_view', 'dataset', 'model', 'table', 'view']]] = None) List[Union[FeatureView, Dataset, ModelVersion, LineageNode]] ¶
Retrieves the lineage nodes connected to this node.
- Parameters:
direction – The direction to trace lineage. Defaults to “downstream”.
domain_filter – Set of domains to filter nodes. Defaults to None.
- Returns:
A list of connected lineage nodes.
- Return type:
List[LineageNode]
This function or method is in private preview since 1.5.3.
- slice(names: List[str]) FeatureViewSlice ¶
Select a subset of features within the FeatureView.
- Parameters:
names – feature names to select.
- Returns:
FeatureViewSlice instance containing selected features.
- Raises:
ValueError – if selected feature names is not found in the FeatureView.
- to_df(session: Session) DataFrame ¶
- to_json() str ¶
Attributes
- database¶
- desc¶
- entities¶
- feature_descs¶
- feature_df¶
- feature_names¶
- name¶
- output_schema¶
- owner¶
- query¶
- refresh_freq¶
- refresh_mode¶
- refresh_mode_reason¶
- schema¶
- status¶
- timestamp_col¶
- version¶
- warehouse¶