airflow.providers.google.cloud.hooks.vertex_ai.feature_store¶
This module contains a Google Cloud Vertex AI Feature Store hook.
Classes¶
Hook for interacting with Google Cloud Vertex AI Feature Store. |
Module Contents¶
- class airflow.providers.google.cloud.hooks.vertex_ai.feature_store.FeatureStoreHook(gcp_conn_id='google_cloud_default', impersonation_chain=None, *, quota_project_id=None, **kwargs)[source]¶
Bases:
airflow.providers.google.common.hooks.base_google.GoogleBaseHookHook for interacting with Google Cloud Vertex AI Feature Store.
This hook provides an interface to manage Feature Store resources in Vertex AI, including feature views and their synchronization operations. It handles authentication and provides methods for common Feature Store operations.
- Parameters:
gcp_conn_id (str) – The connection ID to use for connecting to Google Cloud Platform. Defaults to ‘google_cloud_default’.
impersonation_chain (str | collections.abc.Sequence[str] | None) – Optional service account to impersonate using short-term credentials. Can be either a single account or a chain of accounts required to get the access_token of the last account in the list, which will be impersonated in the request. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account.
- get_feature_online_store_admin_service_client(location=None)[source]¶
Create and returns a FeatureOnlineStoreAdminServiceClient object.
This method initializes a client for interacting with the Feature Store API, handling proper endpoint configuration based on the specified location.
- Parameters:
location (str | None) – Optional. The Google Cloud region where the service is located. If provided and not ‘global’, the client will be configured to use the region-specific API endpoint.
- create_feature_online_store(feature_online_store_id, feature_online_store, project_id=PROVIDE_PROJECT_ID, location=None, timeout=DEFAULT, retry=DEFAULT, metadata=())[source]¶
Create and sends request for Feature Online store.
This method initiates VertexAI Feature Online Store creation request. Feature Online Store aims to serve and manage features data as a part of VertexAI MLOps.
- Parameters:
feature_online_store_id (str) – The ID of the online feature store.
feature_online_store (google.cloud.aiplatform_v1beta1.types.FeatureOnlineStore) – The configuration of the online repository.
project_id (str) – The ID of the Google Cloud project that contains the feature store. If not provided, will attempt to determine from the environment.
location (str | None) – The Google Cloud region where the feature store is located (e.g., ‘us-central1’, ‘us-east1’).
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault | None) – Designation of what errors, if any, should be retried.
timeout (float | google.api_core.gapic_v1.method._MethodDefault) – The timeout for this request.
metadata (collections.abc.Sequence[tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- get_feature_online_store(feature_online_store_id, project_id=PROVIDE_PROJECT_ID, location=None, timeout=DEFAULT, retry=DEFAULT, metadata=())[source]¶
Get Feature Online store data.
Get the FeatureOnlineStore details. Vertex AI Feature Online Store provides a centralized repository for serving ML features and embedding indexes at low latency.
- Parameters:
feature_online_store_id (str) – The ID of the online feature store.
project_id (str) – The ID of the Google Cloud project that contains the feature store. If not provided, will attempt to determine from the environment.
location (str | None) – The Google Cloud region where the feature store is located (e.g., ‘us-central1’, ‘us-east1’).
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault | None) – Designation of what errors, if any, should be retried.
timeout (float | google.api_core.gapic_v1.method._MethodDefault) – The timeout for this request.
metadata (collections.abc.Sequence[tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- create_feature_view(feature_view_id, feature_view, feature_online_store_id, project_id=PROVIDE_PROJECT_ID, run_sync_immediately=False, location=None, timeout=DEFAULT, retry=DEFAULT, metadata=())[source]¶
Create request for Feature View creation.
This method initiates VertexAI Feature View request for the existing Feature Online Store. Feature View represents features and data according to the source provided.
- Parameters:
feature_view_id (str) – The ID to use for the FeatureView, which will become the final component of the FeatureView’s resource name. This value may be up to 60 characters, and valid characters are
[a-z0-9_]. The first character cannot be a number. The value must be unique within a FeatureOnlineStore.feature_view (google.cloud.aiplatform_v1beta1.types.FeatureView) – The configuration of the FeatureView to create.
feature_online_store_id (str) – The ID of the online feature store.
run_sync_immediately (bool) – If set to true, one on demand sync will be run immediately, regardless the FeatureView.sync_config.
project_id (str) – The ID of the Google Cloud project that contains the feature store. If not provided, will attempt to determine from the environment.
location (str | None) – The Google Cloud region where the feature store is located (e.g., ‘us-central1’, ‘us-east1’).
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault | None) – Designation of what errors, if any, should be retried.
timeout (float | google.api_core.gapic_v1.method._MethodDefault) – The timeout for this request.
metadata (collections.abc.Sequence[tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- get_feature_view_sync(location, feature_view_sync_name)[source]¶
Retrieve the status and details of a Feature View synchronization operation.
This method fetches information about a specific feature view sync operation, including its current status, timing information, and synchronization metrics.
- sync_feature_view(location, feature_online_store_id, feature_view_id, project_id=PROVIDE_PROJECT_ID)[source]¶
Initiate a synchronization operation for a Feature View.
This method triggers a sync operation that updates the online serving data for a feature view based on the latest data in the underlying batch source. The sync operation ensures that the online feature values are up-to-date for real-time serving.
- Parameters:
location (str) – The Google Cloud region where the feature store is located (e.g., ‘us-central1’, ‘us-east1’).
feature_online_store_id (str) – The ID of the online feature store that contains the feature view to be synchronized.
feature_view_id (str) – The ID of the feature view to synchronize.
project_id (str) – The ID of the Google Cloud project that contains the feature store. If not provided, will attempt to determine from the environment.
- fetch_feature_values(feature_view_id, feature_online_store_id, entity_id=None, project_id=PROVIDE_PROJECT_ID, endpoint_domain_name=None, data_key=None, data_format=None, location=None, timeout=DEFAULT, retry=DEFAULT, metadata=())[source]¶
Fetch data from the Feature View provided.
This method fetches data from existing Feature view, filtered by provided (or default) data_key. Helps to retrieve actual features data hosted in the VertexAI Feature Store.
- Parameters:
entity_id (str | None) – Simple ID to identify Entity to fetch feature values for.
endpoint_domain_name (str | None) – Optional. Public domain name, hosting the content of Optimized Feature Online store. Should be omitted, if bigtable configuration provided for the FeatureStore, and default feature store endpoint will be used, based on location provided.
feature_view_id (str) – The FeatureView ID to fetch data from.
feature_online_store_id (str) – The ID of the online feature store.
data_key (google.cloud.aiplatform_v1beta1.types.FeatureViewDataKey | None) – Optional. The request key to fetch feature values for.
data_format (int | None) – Optional. Response data format. If not set, FeatureViewDataFormat.KEY_VALUE will be used.
project_id (str) – The ID of the Google Cloud project that contains the feature store. If not provided, will attempt to determine from the environment.
location (str | None) – The Google Cloud region where the feature store is located (e.g., ‘us-central1’, ‘us-east1’).
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault | None) – Designation of what errors, if any, should be retried.
timeout (float | google.api_core.gapic_v1.method._MethodDefault) – The timeout for this request.
metadata (collections.abc.Sequence[tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- delete_feature_view(feature_view_id, feature_online_store_id, project_id=PROVIDE_PROJECT_ID, location=None, timeout=DEFAULT, retry=DEFAULT, metadata=())[source]¶
Delete the Feature View.
This method deletes the Feature View from the Feature Online Store.
- Parameters:
feature_view_id (str) – The ID to use for the FeatureView, to be deleted.
feature_online_store_id (str) – The ID of the online feature store.
project_id (str) – The ID of the Google Cloud project that contains the feature store. If not provided, will attempt to determine from the environment.
location (str | None) – The Google Cloud region where the feature store is located (e.g., ‘us-central1’, ‘us-east1’).
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault | None) – Designation of what errors, if any, should be retried.
timeout (float | google.api_core.gapic_v1.method._MethodDefault) – The timeout for this request.
metadata (collections.abc.Sequence[tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- delete_feature_online_store(feature_online_store_id, force=False, project_id=PROVIDE_PROJECT_ID, location=None, timeout=DEFAULT, retry=DEFAULT, metadata=())[source]¶
Delete the FeatureOnlineStore.
This method deletes the Feature Online Store and all features data. The FeatureOnlineStore must not contain any FeatureViews.
- Parameters:
feature_online_store_id (str) – The ID of the online feature store.
force (bool) – If set to true, any FeatureViews and Features for this FeatureOnlineStore will also be deleted.
project_id (str) – The ID of the Google Cloud project that contains the feature store. If not provided, will attempt to determine from the environment.
location (str | None) – The Google Cloud region where the feature store is located (e.g., ‘us-central1’, ‘us-east1’).
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault | None) – Designation of what errors, if any, should be retried.
timeout (float | google.api_core.gapic_v1.method._MethodDefault) – The timeout for this request.
metadata (collections.abc.Sequence[tuple[str, str]]) – Strings which should be sent along with the request as metadata.