Skip to main content

contexts

Creates, updates, deletes, gets or lists a contexts resource.

Overview

Namecontexts
TypeResource
Idgoogle.aiplatform.contexts

Fields

NameDatatypeDescription
namestringImmutable. The resource name of the Context.
descriptionstringDescription of the Context
createTimestringOutput only. Timestamp when this Context was created.
displayNamestringUser provided display name of the Context. May be up to 128 Unicode characters.
etagstringAn eTag used to perform consistent read-modify-write updates. If not set, a blind "overwrite" update happens.
labelsobjectThe labels with user-defined metadata to organize your Contexts. 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. No more than 64 user labels can be associated with one Context (System labels are excluded).
metadataobjectProperties of the Context. Top level metadata keys' heading and trailing spaces will be trimmed. The size of this field should not exceed 200KB.
parentContextsarrayOutput only. A list of resource names of Contexts that are parents of this Context. A Context may have at most 10 parent_contexts.
schemaTitlestringThe title of the schema describing the metadata. Schema title and version is expected to be registered in earlier Create Schema calls. And both are used together as unique identifiers to identify schemas within the local metadata store.
schemaVersionstringThe version of the schema in schema_name to use. Schema title and version is expected to be registered in earlier Create Schema calls. And both are used together as unique identifiers to identify schemas within the local metadata store.
updateTimestringOutput only. Timestamp when this Context was last updated.

Methods

NameAccessible byRequired ParamsDescription
getSELECTcontextsId, locationsId, metadataStoresId, projectsIdRetrieves a specific Context.
listSELECTlocationsId, metadataStoresId, projectsIdLists Contexts on the MetadataStore.
query_context_lineage_subgraphSELECTcontextsId, locationsId, metadataStoresId, projectsIdRetrieves Artifacts and Executions within the specified Context, connected by Event edges and returned as a LineageSubgraph.
createINSERTlocationsId, metadataStoresId, projectsIdCreates a Context associated with a MetadataStore.
deleteDELETEcontextsId, locationsId, metadataStoresId, projectsIdDeletes a stored Context.
patchUPDATEcontextsId, locationsId, metadataStoresId, projectsIdUpdates a stored Context.
purgeEXEClocationsId, metadataStoresId, projectsIdPurges Contexts.

SELECT examples

Lists Contexts on the MetadataStore.

SELECT
name,
description,
createTime,
displayName,
etag,
labels,
metadata,
parentContexts,
schemaTitle,
schemaVersion,
updateTime
FROM google.aiplatform.contexts
WHERE locationsId = '{{ locationsId }}'
AND metadataStoresId = '{{ metadataStoresId }}'
AND projectsId = '{{ projectsId }}';

INSERT example

Use the following StackQL query and manifest file to create a new contexts resource.

/*+ create */
INSERT INTO google.aiplatform.contexts (
locationsId,
metadataStoresId,
projectsId,
schemaVersion,
etag,
schemaTitle,
description,
name,
labels,
displayName,
metadata
)
SELECT
'{{ locationsId }}',
'{{ metadataStoresId }}',
'{{ projectsId }}',
'{{ schemaVersion }}',
'{{ etag }}',
'{{ schemaTitle }}',
'{{ description }}',
'{{ name }}',
'{{ labels }}',
'{{ displayName }}',
'{{ metadata }}'
;

UPDATE example

Updates a contexts resource.

/*+ update */
UPDATE google.aiplatform.contexts
SET
schemaVersion = '{{ schemaVersion }}',
etag = '{{ etag }}',
schemaTitle = '{{ schemaTitle }}',
description = '{{ description }}',
name = '{{ name }}',
labels = '{{ labels }}',
displayName = '{{ displayName }}',
metadata = '{{ metadata }}'
WHERE
contextsId = '{{ contextsId }}'
AND locationsId = '{{ locationsId }}'
AND metadataStoresId = '{{ metadataStoresId }}'
AND projectsId = '{{ projectsId }}';

DELETE example

Deletes the specified contexts resource.

/*+ delete */
DELETE FROM google.aiplatform.contexts
WHERE contextsId = '{{ contextsId }}'
AND locationsId = '{{ locationsId }}'
AND metadataStoresId = '{{ metadataStoresId }}'
AND projectsId = '{{ projectsId }}';