apache_beam.transforms.enrichment_handlers.feast_feature_store module

class apache_beam.transforms.enrichment_handlers.feast_feature_store.FeastFeatureStoreEnrichmentHandler(feature_store_yaml_path: str, feature_names: List[str] | None = None, feature_service_name: str | None = '', full_feature_names: bool | None = False, entity_id: str = '', *, entity_row_fn: Callable[[Row], Mapping[str, Any]] | None = None, exception_level: ExceptionLevel = ExceptionLevel.WARN)[source]

Bases: EnrichmentSourceHandler[Row, Row]

Enrichment handler to interact with the Feast feature store.

To specify the features to fetch from Feast online store, please specify exactly one of feature_names or feature_service_name.

Use this handler with apache_beam.transforms.enrichment.Enrichment transform. To filter the features to enrich, use the join_fn param in apache_beam.transforms.enrichment.Enrichment.

Initializes an instance of FeastFeatureStoreEnrichmentHandler.

Parameters:
  • feature_store_yaml_path (str) – The path to a YAML configuration file for the Feast feature store. See https://docs.feast.dev/reference/feature-repository/feature-store-yaml for configuration options supported by Feast.

  • feature_names – A list of feature names to be retrieved from the online Feast feature store.

  • feature_service_name (str) – The name of the feature service containing the features to fetch from the online Feast feature store.

  • full_feature_names (bool) – Whether to use full feature names (including namespaces, etc.). Defaults to False.

  • entity_id (str) – entity name for the entity associated with the features. The entity_id is used to extract the entity value from the input row. Please provide exactly one of entity_id or entity_row_fn.

  • entity_row_fn – a lambda function that takes an input beam.Row and returns a dictionary with a mapping from the entity key column name to entity key value. It is used to build/extract the entity dict for feature retrieval. Please provide exactly one of entity_id or entity_row_fn. See https://docs.feast.dev/getting-started/concepts/feature-retrieval for more information.

  • exception_level – a enum.Enum value from apache_beam.transforms.enrichment_handlers.utils.ExceptionLevel to set the level when None feature values are fetched from the online Feast store. Defaults to ExceptionLevel.WARN.

get_cache_key(request: Row) str[source]

Returns a string formatted with unique entity-id for the feature values.