Class EntityType (1.10.0)

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

Managed entityType resource for Vertex AI.

Inheritance

builtins.object >google.cloud.aiplatform.base.VertexAiResourceNoun >builtins.object >google.cloud.aiplatform.base.FutureManager >google.cloud.aiplatform.base.VertexAiResourceNounWithFutureManager >EntityType

Properties

featurestore_name

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

Methods

EntityType

EntityType(entity_type_name:str,featurestore_id:Optional[str]=None,project:Optional[str]=None,location:Optional[str]=None,credentials: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:Dict[str,Dict[str,Union[bool,int,Dict[str,str],str]]],request_metadata:Optional[Sequence[Tuple[str,str]]]=(),sync:bool=True,)

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",            },    })
Parameters
NameDescription
feature_configsDict[str, Dict[str, Union[bool, int, Dict[str, str], str]]]

Required. A user defined Dict containing configurations for feature creation. The feature_configs Dict[str, Dict] i.e. {feature_id: feature_config} contains configuration for each creating feature: .. rubric:: Example feature_configs = { "my_feature_id_1": feature_config_1, "my_feature_id_2": feature_config_2, "my_feature_id_3": feature_config_3, } Each feature_config requires "value_type", and optional "description", "labels": .. rubric:: Example feature_config_1 = { "value_type": "INT64", } feature_config_2 = { "value_type": "BOOL", "description": "my feature id 2 description" } feature_config_3 = { "value_type": "STRING", "labels": { "my key": "my value", } }

request_metadataSequence[Tuple[str, str]]

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

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.

create

create(entity_type_id:str,featurestore_name:str,description:Optional[str]=None,labels:Optional[Dict[str,str]]=None,project:Optional[str]=None,location:Optional[str]=None,credentials:Optional[google.auth.credentials.Credentials]=None,request_metadata:Optional[Sequence[Tuple[str,str]]]=(),sync:bool=True,)

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',)
Parameters
NameDescription
entity_type_idstr

Required. The ID to use for the EntityType, which will become the final component of the EntityType'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 featurestore.

featurestore_namestr

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

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 EntityType (System labels are excluded)." System reserved label keys are prefixed with "aiplatform.googleapis.com/" and are immutable.

projectstr

Optional. Project to create EntityType in iffeaturestore_name is passed an featurestore ID. If not set, project set in aiplatform.init will be used.

locationstr

Optional. Location to create EntityType in iffeaturestore_name is passed an featurestore ID. If not set, location set in aiplatform.init will be used.

credentialsauth_credentials.Credentials

Optional. Custom credentials to use to create EntityTypes. Overrides credentials set in aiplatform.init.

request_metadataSequence[Tuple[str, str]]

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

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.

create_feature

create_feature(feature_id:str,value_type:str,description:Optional[str]=None,labels:Optional[Dict[str,str]]=None,request_metadata:Optional[Sequence[Tuple[str,str]]]=(),sync:bool=True,)

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.

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)

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.

Parameters
NameDescription
forcebool

If set to true, any Features for this EntityType will also be deleted. (Otherwise, the request will only work if the EntityType has no Features.)

syncbool

Whether to execute this deletion 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.

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

delete_features

delete_features(feature_ids:List[str],sync:bool=True)

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

Parameters
NameDescription
feature_idsList[str]

Required. The list of feature IDs to be deleted.

syncbool

Optional. Whether to execute this deletion 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.

get_feature

get_feature(feature_id:str)

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()

Retrieves the managed featurestore in which this EntityType is.

ingest_from_bq

ingest_from_bq(feature_ids:List[str],feature_time:Union[str,datetime.datetime],bq_source_uri:str,feature_source_fields:Optional[Dict[str,str]]=None,entity_id_field:Optional[str]=None,disable_online_serving:Optional[bool]=None,worker_count:Optional[int]=None,request_metadata:Optional[Sequence[Tuple[str,str]]]=(),sync:bool=True,)

Ingest feature values from BigQuery.

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. - A single Feature timestamp for all entities being imported. The timestamp must not have higher than millisecond precision.

bq_source_uristr

Required. BigQuery URI to the input table. .. rubric:: Example 'bq://project.dataset.table_name'

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.

disable_online_servingbool

Optional. If set, data will not be imported for online serving. This is typically used for backfilling, where Feature generation timestamps are not in the timestamp range needed for online serving.

worker_countint

Optional. Specifies the number of workers that are used to write data to the Featurestore. Consider the online serving capacity that you require to achieve the desired import throughput without interfering with online serving. The value must be positive, and less than or equal to 100. If not set, defaults to using 1 worker. The low count ensures minimal impact on online serving performance.

request_metadataSequence[Tuple[str, str]]

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

syncbool

Optional. Whether to execute this import 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.

ingest_from_df

ingest_from_df(feature_ids:List[str],feature_time:Union[str,datetime.datetime],df_source:pd.DataFrame,feature_source_fields:Optional[Dict[str,str]]=None,entity_id_field:Optional[str]=None,request_metadata:Optional[Sequence[Tuple[str,str]]]=(),)
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")

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.

df_sourcepd.DataFrame

Required. Pandas DataFrame containing the source data for ingestion.

ingest_from_gcs

ingest_from_gcs(feature_ids:List[str],feature_time:Union[str,datetime.datetime],gcs_source_uris:Union[str,List[str]],gcs_source_type:str,feature_source_fields:Optional[Dict[str,str]]=None,entity_id_field:Optional[str]=None,disable_online_serving:Optional[bool]=None,worker_count:Optional[int]=None,request_metadata:Optional[Sequence[Tuple[str,str]]]=(),sync:bool=True,)

Ingest feature values from GCS.

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. - A single Feature timestamp for all entities being imported. The timestamp must not have higher than millisecond precision.

gcs_source_urisUnion[str, List[str]]

Required. Google Cloud Storage URI(-s) to the input file(s). May contain wildcards. For more information on wildcards, seehttps://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames. .. rubric:: Example ["gs://my_bucket/my_file_1.csv", "gs://my_bucket/my_file_2.csv"] or "gs://my_bucket/my_file.avro"

gcs_source_typestr

Required. The type of the input file(s) provided bygcs_source_uris, the value of gcs_source_type can only be eithercsv, oravro.

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.

disable_online_servingbool

Optional. If set, data will not be imported for online serving. This is typically used for backfilling, where Feature generation timestamps are not in the timestamp range needed for online serving.

worker_countint

Optional. Specifies the number of workers that are used to write data to the Featurestore. Consider the online serving capacity that you require to achieve the desired import throughput without interfering with online serving. The value must be positive, and less than or equal to 100. If not set, defaults to using 1 worker. The low count ensures minimal impact on online serving performance.

request_metadataSequence[Tuple[str, str]]

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

syncbool

Optional. Whether to execute this import 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.

Exceptions
TypeDescription
ValueErroif gcs_source_type is not supported.:

list

list(featurestore_name:str,filter:Optional[str]=None,order_by:Optional[str]=None,project:Optional[str]=None,location:Optional[str]=None,credentials:Optional[google.auth.credentials.Credentials]=None,)

Lists existing managed entityType resources in a featurestore, given a featurestore resource name or a featurestore ID.

Example Usage:

my_entityTypes = aiplatform.EntityType.list(    featurestore_name='projects/123/locations/us-central1/featurestores/my_featurestore_id')ormy_entityTypes = aiplatform.EntityType.list(    featurestore_name='my_featurestore_id')
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

list_features(filter:Optional[str]=None,order_by:Optional[str]=None)

Lists existing managed 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_entityType.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

read(entity_ids:Union[str,List[str]],feature_ids:Union[str,List[str]]="*",request_metadata:Optional[Sequence[Tuple[str,str]]]=(),)

Reads feature values for given feature IDs of given entity IDs in this EntityType.

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.

Returns
TypeDescription
pd.DataFrameentities' feature values in DataFrame

update

update(description:Optional[str]=None,labels:Optional[Dict[str,str]]=None,request_metadata:Sequence[Tuple[str,str]]=(),)

Updates an existing managed entityType resource.

Example Usage:

my_entity_type = aiplatform.EntityType(    entity_type_name='my_entity_type_id',    featurestore_id='my_featurestore_id',)my_entity_type.update(    description='update my description',)
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.

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 2026-01-28 UTC.