Class EntityType (1.73.0)

EntityType(entity_type_name:str,featurestore_id:typing.Optional[str]=None,project:typing.Optional[str]=None,location:typing.Optional[str]=None,credentials:typing.Optional[google.auth.credentials.Credentials]=None,)

Public managed EntityType resource for Vertex AI.

Properties

create_time

Time this resource was created.

display_name

Display name of this resource.

encryption_spec

Customer-managed encryption key options for this Vertex AI resource.

If this is set, then all resources created by this Vertex AI resource willbe encrypted with the provided encryption key.

featurestore_name

Full qualified resource name of the managed featurestore in which this EntityType is.

gca_resource

The underlying resource proto representation.

labels

name

Name of this resource.

preview

Exposes features available in preview for this class.

resource_name

Full qualified resource name.

update_time

Time this resource was last updated.

Methods

EntityType

EntityType(entity_type_name:str,featurestore_id:typing.Optional[str]=None,project:typing.Optional[str]=None,location:typing.Optional[str]=None,credentials:typing.Optional[google.auth.credentials.Credentials]=None,)

Retrieves an existing managed entityType given an entityType resource name or an entity_type ID.

Example Usage:

my_entity_type = aiplatform.EntityType(    entity_type_name='projects/123/locations/us-central1/featurestores/my_featurestore_id/                entityTypes/my_entity_type_id')ormy_entity_type = aiplatform.EntityType(    entity_type_name='my_entity_type_id',    featurestore_id='my_featurestore_id',)
Parameters
NameDescription
entity_type_namestr

Required. A fully-qualified entityType resource name or an entity_type ID. Example: "projects/123/locations/us-central1/featurestores/my_featurestore_id/entityTypes/my_entity_type_id" or "my_entity_type_id" when project and location are initialized or passed, with featurestore_id passed.

featurestore_idstr

Optional. Featurestore ID of an existing featurestore to retrieve entityType from, when entity_type_name is passed as entity_type ID.

projectstr

Optional. Project to retrieve entityType from. If not set, project set in aiplatform.init will be used.

locationstr

Optional. Location to retrieve entityType from. If not set, location set in aiplatform.init will be used.

credentialsauth_credentials.Credentials

Optional. Custom credentials to use to retrieve this EntityType. Overrides credentials set in aiplatform.init.

batch_create_features

batch_create_features(feature_configs:typing.Dict[str,typing.Dict[str,typing.Union[bool,int,typing.Dict[str,str],str]]],request_metadata:typing.Optional[typing.Sequence[typing.Tuple[str,str]]]=(),sync:bool=True,)->google.cloud.aiplatform.featurestore._entity_type._EntityType

Batch creates Feature resources in this EntityType.

Example Usage:

my_entity_type = aiplatform.EntityType(    entity_type_name='my_entity_type_id',    featurestore_id='my_featurestore_id',)my_entity_type.batch_create_features(    feature_configs={        "my_feature_id1": {                "value_type": "INT64",            },        "my_feature_id2": {                "value_type": "BOOL",            },        "my_feature_id3": {                "value_type": "STRING",            },    })

create

create(entity_type_id:str,featurestore_name:str,description:typing.Optional[str]=None,labels:typing.Optional[typing.Dict[str,str]]=None,project:typing.Optional[str]=None,location:typing.Optional[str]=None,credentials:typing.Optional[google.auth.credentials.Credentials]=None,request_metadata:typing.Optional[typing.Sequence[typing.Tuple[str,str]]]=(),sync:bool=True,create_request_timeout:typing.Optional[float]=None,)->google.cloud.aiplatform.featurestore._entity_type._EntityType

Creates an EntityType resource in a Featurestore.

Example Usage:

my_entity_type = aiplatform.EntityType.create(    entity_type_id='my_entity_type_id',    featurestore_name='projects/123/locations/us-central1/featurestores/my_featurestore_id')ormy_entity_type = aiplatform.EntityType.create(    entity_type_id='my_entity_type_id',    featurestore_name='my_featurestore_id',)

create_feature

create_feature(feature_id:str,value_type:str,description:typing.Optional[str]=None,labels:typing.Optional[typing.Dict[str,str]]=None,request_metadata:typing.Optional[typing.Sequence[typing.Tuple[str,str]]]=(),sync:bool=True,create_request_timeout:typing.Optional[float]=None,)->google.cloud.aiplatform.featurestore.feature.Feature

Creates a Feature resource in this EntityType.

Example Usage:

my_entity_type = aiplatform.EntityType(    entity_type_name='my_entity_type_id',    featurestore_id='my_featurestore_id',)my_feature = my_entity_type.create_feature(    feature_id='my_feature_id',    value_type='INT64',)
Parameters
NameDescription
feature_idstr

Required. The ID to use for the Feature, which will become the final component of the Feature's resource name, which is immutable. 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 an EntityType.

value_typestr

Required. Immutable. Type of Feature value. One of BOOL, BOOL_ARRAY, DOUBLE, DOUBLE_ARRAY, INT64, INT64_ARRAY, STRING, STRING_ARRAY, BYTES.

descriptionstr

Optional. Description of the Feature.

labelsDict[str, str]

Optional. The labels with user-defined metadata to organize your Features. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Seehttps://goo.gl/xmQnxf for more information on and examples of labels. No more than 64 user labels can be associated with one Feature (System labels are excluded)." System reserved label keys are prefixed with "aiplatform.googleapis.com/" and are immutable.

request_metadataSequence[Tuple[str, str]]

Optional. Strings which should be sent along with the request as metadata.

create_request_timeoutfloat

Optional. The timeout for the create request in seconds.

syncbool

Optional. Whether to execute this creation synchronously. If False, this method will be executed in concurrent Future and any downstream object will be immediately returned and synced when the Future has completed.

delete

delete(sync:bool=True,force:bool=False)->None

Deletes this EntityType resource. If force is set to True,all features in this EntityType will be deleted prior to entityType deletion.

WARNING: This deletion is permanent.

Exceptions
TypeDescription
FailedPreconditionIf features are created in this EntityType and force = False.

delete_features

delete_features(feature_ids:typing.List[str],sync:bool=True)->None

Deletes feature resources in this EntityType given their feature IDs.WARNING: This deletion is permanent.

get_feature

get_feature(feature_id:str,)->google.cloud.aiplatform.featurestore.feature.Feature

Retrieves an existing managed feature in this EntityType.

Parameter
NameDescription
feature_idstr

Required. The managed feature resource ID in this EntityType.

get_featurestore

get_featurestore()->(google.cloud.aiplatform.featurestore.featurestore.Featurestore)

Retrieves the managed featurestore in which this EntityType is.

ingest_from_bq

ingest_from_bq(feature_ids:typing.List[str],feature_time:typing.Union[str,datetime.datetime],bq_source_uri:str,feature_source_fields:typing.Optional[typing.Dict[str,str]]=None,entity_id_field:typing.Optional[str]=None,disable_online_serving:typing.Optional[bool]=None,worker_count:typing.Optional[int]=None,request_metadata:typing.Optional[typing.Sequence[typing.Tuple[str,str]]]=(),sync:bool=True,ingest_request_timeout:typing.Optional[float]=None,)->google.cloud.aiplatform.featurestore._entity_type._EntityType

Ingest feature values from BigQuery.

ingest_from_df

ingest_from_df(feature_ids:typing.List[str],feature_time:typing.Union[str,datetime.datetime],df_source:pd.DataFrame,feature_source_fields:typing.Optional[typing.Dict[str,str]]=None,entity_id_field:typing.Optional[str]=None,request_metadata:typing.Optional[typing.Sequence[typing.Tuple[str,str]]]=(),ingest_request_timeout:typing.Optional[float]=None,)->_EntityType
Parameters
NameDescription
feature_idsList[str]

Required. IDs of the Feature to import values of. The Features must exist in the target EntityType, or the request will fail.

feature_timeUnion[str, datetime.datetime]

Required. The feature_time can be one of: - The source column that holds the Feature timestamp for all Feature values in each entity. Note: The dtype of the source column should bedatetime64. - A single Feature timestamp for all entities being imported. The timestamp must not have higher than millisecond precision. Example: feature_time = datetime.datetime(year=2022, month=1, day=1, hour=11, minute=59, second=59) or feature_time_str = datetime.datetime.now().isoformat(sep=" ", timespec="milliseconds") feature_time = datetime.datetime.strptime(feature_time_str, "%Y-%m-%d %H:%M:%S.%f")

df_sourcepd.DataFrame

Required. Pandas DataFrame containing the source data for ingestion.

feature_source_fieldsDict[str, str]

Optional. User defined dictionary to map ID of the Feature for importing values of to the source column for getting the Feature values from. Specify the features whose ID and source column are not the same. If not provided, the source column need to be the same as the Feature ID. .. rubric:: Example feature_ids = ['my_feature_id_1', 'my_feature_id_2', 'my_feature_id_3'] feature_source_fields = { 'my_feature_id_1': 'my_feature_id_1_source_field', } Note: The source column of 'my_feature_id_1' is 'my_feature_id_1_source_field', The source column of 'my_feature_id_2' is the ID of the feature, same for 'my_feature_id_3'.

entity_id_fieldstr

Optional. Source column that holds entity IDs. If not provided, entity IDs are extracted from the column namedentity_id.

request_metadataSequence[Tuple[str, str]]

Optional. Strings which should be sent along with the request as metadata.

ingest_request_timeoutfloat

Optional. The timeout for the ingest request in seconds.

ingest_from_gcs

Exceptions
TypeDescription
ValueErroif gcs_source_type is not supported.:

list

Parameters
NameDescription
featurestore_namestr

Required. A fully-qualified featurestore resource name or a featurestore ID of an existing featurestore to list entityTypes in. Example: "projects/123/locations/us-central1/featurestores/my_featurestore_id" or "my_featurestore_id" when project and location are initialized or passed.

filterstr

Optional. Lists the EntityTypes that match the filter expression. The following filters are supported: -create_time: Supports=,!=,<,>,>=, and<= comparisons. Values must be in RFC 3339 format. -update_time: Supports=,!=,<,>,>=, and<= comparisons. Values must be in RFC 3339 format. -labels: Supports key-value equality as well as key presence. Examples: -create_time > "2020-01-31T15:30:00.000000Z" OR update_time > "2020-01-31T15:30:00.000000Z" --> EntityTypes created or updated after 2020-01-31T15:30:00.000000Z. -labels.active = yes AND labels.env = prod --> EntityTypes having both (active: yes) and (env: prod) labels. -labels.env: * --> Any EntityType which has a label with 'env' as the key.

order_bystr

Optional. A comma-separated list of fields to order by, sorted in ascending order. Use "desc" after a field name for descending. Supported fields: -entity_type_id -create_time -update_time

projectstr

Optional. Project to list entityTypes in. If not set, project set in aiplatform.init will be used.

locationstr

Optional. Location to list entityTypes in. If not set, location set in aiplatform.init will be used.

credentialsauth_credentials.Credentials

Optional. Custom credentials to use to list entityTypes. Overrides credentials set in aiplatform.init.

list_features

Parameters
NameDescription
filterstr

Optional. Lists the Features that match the filter expression. The following filters are supported: -value_type: Supports = and != comparisons. -create_time: Supports =, !=, <, >, >=, and <= comparisons. Values must be in RFC 3339 format. -update_time: Supports =, !=, <, >, >=, and <= comparisons. Values must be in RFC 3339 format. -labels: Supports key-value equality as well as key presence. Examples: -value_type = DOUBLE --> Features whose type is DOUBLE. -create_time > "2020-01-31T15:30:00.000000Z" OR update_time > "2020-01-31T15:30:00.000000Z" --> EntityTypes created or updated after 2020-01-31T15:30:00.000000Z. -labels.active = yes AND labels.env = prod --> Features having both (active: yes) and (env: prod) labels. -labels.env: * --> Any Feature which has a label with 'env' as the key.

order_bystr

Optional. A comma-separated list of fields to order by, sorted in ascending order. Use "desc" after a field name for descending. Supported fields: -feature_id -value_type -create_time -update_time

read

Parameters
NameDescription
entity_idsUnion[str, List[str]]

Required. ID for a specific entity, or a list of IDs of entities to read Feature values of. The maximum number of IDs is 100 if a list.

feature_idsUnion[str, List[str]]

Required. ID for a specific feature, or a list of IDs of Features in the EntityType for reading feature values. Default to "*", where value of all features will be read.

request_metadataSequence[Tuple[str, str]]

Optional. Strings which should be sent along with the request as metadata.

read_request_timeoutfloat

Optional. The timeout for the read request in seconds.

Returns
TypeDescription
pd.DataFrameentities' feature values in DataFrame

to_dict

update

Parameters
NameDescription
descriptionstr

Optional. Description of the EntityType.

labelsDict[str, str]

Optional. The labels with user-defined metadata to organize your EntityTypes. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Seehttps://goo.gl/xmQnxf for more information on and examples of labels. No more than 64 user labels can be associated with one Feature (System labels are excluded)." System reserved label keys are prefixed with "aiplatform.googleapis.com/" and are immutable.

request_metadataSequence[Tuple[str, str]]

Required. Strings which should be sent along with the request as metadata.

update_request_timeoutfloat

Optional. The timeout for the update request in seconds.

wait

write_feature_values

Streaming ingestion. Write feature values directly to Feature Store.

my_entity_type = aiplatform.EntityType(    entity_type_name="my_entity_type_id",    featurestore_id="my_featurestore_id",)# writing feature values from a pandas DataFrame without feature timestamp column.# In this case, current timestamp will be applied to all data.my_dataframe = pd.DataFrame(    data = [        {"entity_id": "movie_01", "average_rating": 4.9}    ],    columns=["entity_id", "average_rating"],)my_dataframe = my_df.set_index("entity_id")my_entity_type.write_feature_values(    instances=my_df)# writing feature values from a pandas DataFrame with feature timestamp column# Example of datetime creation.feature_time = datetime.datetime(year=2022, month=1, day=1, hour=11, minute=59, second=59)orfeature_time_str = datetime.datetime.now().isoformat(sep=" ", timespec="milliseconds")feature_time = datetime.datetime.strptime(feature_time_str, "%Y-%m-%d %H:%M:%S.%f")my_dataframe = pd.DataFrame(    data = [        {"entity_id": "movie_01", "average_rating": 4.9,        "feature_timestamp": feature_time}    ],    columns=["entity_id", "average_rating", "feature_timestamp"],)my_dataframe = my_df.set_index("entity_id")my_entity_type.write_feature_values(    instances=my_df, feature_time="feature_timestamp")# writing feature values with a timestamp. The timestamp will be applied to the entire Dataframe.my_dataframe = pd.DataFrame(    data = [        {"entity_id": "movie_01", "average_rating": 4.9}    ],    columns=["entity_id", "average_rating"],)my_dataframe = my_df.set_index("entity_id")my_entity_type.write_feature_values(    instances=my_df, feature_time=feature_time)# writing feature values from a Python dict without timestamp column.# In this case, current timestamp will be applied to all data.my_data_dict = {        "movie_02" : {"average_rating": 3.7}}my_entity_type.write_feature_values(    instances=my_data_dict)# writing feature values from a Python dict with timestamp columnmy_data_dict = {        "movie_02" : {"average_rating": 3.7, "feature_timestamp": timestmap}}}my_entity_type.write_feature_values(    instances=my_data_dict, feature_time="feature_timestamp")# writing feature values from a Python dict and apply the same Feature_Timestampmy_data_dict = {        "movie_02" : {"average_rating": 3.7}}my_entity_type.write_feature_values(    instances=my_data_dict, feature_time=feature_time)# writing feature values from a list of WriteFeatureValuesPayload objectspayloads = [    gca_featurestore_online_service.WriteFeatureValuesPayload(        entity_id="movie_03",        feature_values={                "average_rating": featurestore_online_service.FeatureValue(                        string_value="test",                        metadata=featurestore_online_service.FeatureValue.Metadata(                                generate_time=timestmap                        )               }        }    )]# when instance is WriteFeatureValuesPayload,# feature_time param of write_feature_values() is ignored.my_entity_type.write_feature_values(    instances=payloads)# reading back written feature valuesmy_entity_type.read(    entity_ids=["movie_01", "movie_02", "movie_03"])

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-30 UTC.