Skip to main content

schemas

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

Overview

Nameschemas
TypeResource
Idgoogle.pubsub.schemas

Fields

NameDatatypeDescription
namestringRequired. Name of the schema. Format is projects/{project}/schemas/{schema}.
definitionstringThe definition of the schema. This should contain a string representing the full definition of the schema that is a valid schema definition of the type specified in type.
revisionCreateTimestringOutput only. The timestamp that the revision was created.
revisionIdstringOutput only. Immutable. The revision ID of the schema.
typestringThe type of the schema definition.

Methods

NameAccessible byRequired ParamsDescription
projects_schemas_getSELECTprojectsId, schemasIdGets a schema.
projects_schemas_listSELECTprojectsIdLists schemas in a project.
projects_schemas_createINSERTprojectsIdCreates a schema.
projects_schemas_deleteDELETEprojectsId, schemasIdDeletes a schema.
projects_schemas_commitEXECprojectsId, schemasIdCommits a new schema revision to an existing schema.
projects_schemas_rollbackEXECprojectsId, schemasIdCreates a new schema revision that is a copy of the provided revision_id.
projects_schemas_validateEXECprojectsIdValidates a schema.
projects_schemas_validate_messageEXECprojectsIdValidates a message against a schema.

SELECT examples

Lists schemas in a project.

SELECT
name,
definition,
revisionCreateTime,
revisionId,
type
FROM google.pubsub.schemas
WHERE projectsId = '{{ projectsId }}';

INSERT example

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

/*+ create */
INSERT INTO google.pubsub.schemas (
projectsId,
name,
type,
definition
)
SELECT
'{{ projectsId }}',
'{{ name }}',
'{{ type }}',
'{{ definition }}'
;

DELETE example

Deletes the specified schemas resource.

/*+ delete */
DELETE FROM google.pubsub.schemas
WHERE projectsId = '{{ projectsId }}'
AND schemasId = '{{ schemasId }}';