Manage entity types

Learn how to create, list, and delete entity types.

Create an entity type

Create an entity type so that you can create its related features.

Web UI

  1. In the Vertex AI section of the Google Cloud Console, go to the Features page.

    Go to the Features page

  2. From the action bar, click Create entity type to open the Create entity type pane.
  3. Select a region from the Region drop-down list that includes the featurestore where you want to create an entity type.
  4. Select a featurestore.
  5. Specify a name for the entity type.
  6. If you want to include a description for the entity type, enter a description.
  7. To enable feature value monitoring (Preview), set monitoring to Enabled and then specify the snapshot interval in days. This monitoring configuration applies to all features under this entity type. For more information, see Feature value monitoring.
  8. Click Create.

REST & CMD LINE

To create an entity type, send a POST request by using the featurestores.entityTypes.create method.

Before using any of the request data, make the following replacements:

  • LOCATION: Region where the featurestore is located, such as us-central1.
  • PROJECT: Your project ID or project number.
  • FEATURESTORE_ID: ID of the featurestore.
  • ENTITY_TYPE_ID: ID of the entity type.
  • DESCRIPTION: Description of the entity type.
  • PROJECT_NUMBER: Project number for your project (appears in the response).

HTTP method and URL:

POST https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/featurestores/FEATURESTORE_ID/entityTypes?entityTypeId=ENTITY_TYPE_ID

Request JSON body:

{
  "description": "DESCRIPTION"
}

To send your request, choose one of these options:

curl

Save the request body in a file called request.json, and execute the following command:

curl -X POST \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/featurestores/FEATURESTORE_ID/entityTypes?entityTypeId=ENTITY_TYPE_ID"

PowerShell

Save the request body in a file called request.json, and execute the following command:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/featurestores/FEATURESTORE_ID/entityTypes?entityTypeId=ENTITY_TYPE_ID" | Select-Object -Expand Content

You should see output similar to the following. You can use the OPERATION_ID in the response to get the status of the operation.

{
  "name": "projects/PROJECT_NUMBER/locations/LOCATION/featurestores/FEATURESTORE_ID/entityTypes/bikes/operations/OPERATION_ID",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.aiplatform.v1.CreateEntityTypeOperationMetadata",
    "genericMetadata": {
      "createTime": "2021-03-02T00:04:13.039166Z",
      "updateTime": "2021-03-02T00:04:13.039166Z"
    }
  }
}

Python

from google.cloud import aiplatform_v1beta1 as aiplatform


def create_entity_type_sample(
    project: str,
    featurestore_id: str,
    entity_type_id: str,
    description: str = "sample entity type",
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
    timeout: int = 300,
):
    # The AI Platform services require regional API endpoints, which need to be
    # in the same region or multi-region overlap with the Feature Store location.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.FeaturestoreServiceClient(client_options=client_options)
    parent = f"projects/{project}/locations/{location}/featurestores/{featurestore_id}"
    create_entity_type_request = aiplatform.CreateEntityTypeRequest(
        parent=parent,
        entity_type_id=entity_type_id,
        entity_type=aiplatform.EntityType(description=description),
    )
    lro_response = client.create_entity_type(request=create_entity_type_request)
    print("Long running operation:", lro_response.operation.name)
    create_entity_type_response = lro_response.result(timeout=timeout)
    print("create_entity_type_response:", create_entity_type_response)

Additional languages

You can install and use the following Vertex AI client libraries to call the Vertex AI API. Cloud Client Libraries provide an optimized developer experience by using each supported language's natural conventions and styles.

List entity types

List all entity types in a featurestore.

Web UI

  1. In the Vertex AI section of the Google Cloud Console, go to the Features page.

    Go to the Features page

  2. Select a region from the Region drop-down list.
  3. In the features table, view the Entity type column to see the entity types in your project for the selected region.

REST & CMD LINE

To list entity types, send a GET request by using the featurestores.entityTypes.list method.

Before using any of the request data, make the following replacements:

  • LOCATION: Region where the featurestore is located, such as us-central1.
  • PROJECT: Your project ID or project number.
  • FEATURESTORE_ID: ID of the featurestore.
  • PROJECT_NUMBER: Project number for your project (appears in the response).

HTTP method and URL:

GET https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/featurestores/FEATURESTORE_ID/entityTypes

To send your request, choose one of these options:

curl

Execute the following command:

curl -X GET \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/featurestores/FEATURESTORE_ID/entityTypes"

PowerShell

Execute the following command:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/featurestores/FEATURESTORE_ID/entityTypes" | Select-Object -Expand Content

You should receive a JSON response similar to the following:

{
  "entityTypes": [
    {
      "name": "projects/PROJECT_NUMBER/locations/LOCATION/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID_1",
      "description": "ENTITY_TYPE_DESCRIPTION",
      "createTime": "2021-02-25T01:20:43.082628Z",
      "updateTime": "2021-02-25T01:20:43.082628Z",
      "etag": "AMEw9yOBqKIdbBGZcxdKLrlZJAf9eTO2DEzcE81YDKA2LymDMFB8ucRbmKwKo2KnvOg="
    },
    {
      "name": "projects/PROJECT_NUMBER/locations/LOCATION/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID_2",
      "description": "ENTITY_TYPE_DESCRIPTION",
      "createTime": "2021-02-25T01:34:26.198628Z",
      "updateTime": "2021-02-25T01:34:26.198628Z",
      "etag": "AMEw9yNuv-ILYG8VLLm1lgIKc7asGIAVFErjvH2Cyc_wIQm7d6DL4ZGv59cwZmxTumU="
    }
  ]
}

Additional languages

You can install and use the following Vertex AI client libraries to call the Vertex AI API. Cloud Client Libraries provide an optimized developer experience by using each supported language's natural conventions and styles.

Delete an entity type

Delete an entity type. If you use the Cloud Console, Feature Store deletes the entity type and all of its contents. If you use the API, enable the force query parameter to delete the entity type and all of its contents.

Web UI

  1. In the Vertex AI section of the Google Cloud Console, go to the Features page.

    Go to the Features page

  2. Select a region from the Region drop-down list.
  3. In the features table, view the Entity type column and find the entity type to delete.
  4. Click the name of the entity type.
  5. From the action bar, click Delete.
  6. Click Confirm to delete the entity type.

REST & CMD LINE

To delete an entity type, send a DELETE request by using the featurestores.entityTypes.delete method.

Before using any of the request data, make the following replacements:

  • LOCATION: Region where the featurestore is located, such as us-central1.
  • PROJECT: Your project ID or project number.
  • FEATURESTORE_ID: ID of the featurestore.
  • ENTITY_TYPE_ID: ID of the entity type.
  • PROJECT_NUMBER: Project number for your project (appears in the response).
  • BOOLEAN: Whether to delete the entity type even if it contains features. The force query parameter is optional and is false by default.

HTTP method and URL:

DELETE https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID?force=BOOLEAN

To send your request, choose one of these options:

curl

Execute the following command:

curl -X DELETE \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID?force=BOOLEAN"

PowerShell

Execute the following command:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method DELETE `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID?force=BOOLEAN" | Select-Object -Expand Content

You should receive a JSON response similar to the following:

{
  "name": "projects/PROJECT_NUMBER/locations/LOCATION/featurestores/FEATURESTORE_ID/operations/OPERATION_ID",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.aiplatform.v1.DeleteOperationMetadata",
    "genericMetadata": {
      "createTime": "2021-02-26T17:32:56.008325Z",
      "updateTime": "2021-02-26T17:32:56.008325Z"
    }
  },
  "done": true,
  "response": {
    "@type": "type.googleapis.com/google.protobuf.Empty"
  }
}

Additional languages

You can install and use the following Vertex AI client libraries to call the Vertex AI API. Cloud Client Libraries provide an optimized developer experience by using each supported language's natural conventions and styles.

What's next