Skip to main content

schema_versions

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

Overview​

Nameschema_versions
TypeResource
Idgoogle.documentai.schema_versions

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringIdentifier. The resource name of the SchemaVersion. Format: projects/{project}/locations/{location}/schemas/{schema}/schemaVersions/{schema_version}
createTimestring (google-datetime)Output only. The time when the SchemaVersion was created.
displayNamestringRequired. The user-defined name of the SchemaVersion.
labelsobjectOptional. The {{gcp_name_short}} labels for the SchemaVersion.
schemaobjectRequired. The schema of the SchemaVersion. (id: GoogleCloudDocumentaiV1DocumentSchema)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
projects_locations_schemas_schema_versions_getselectprojectsId, locationsId, schemasId, schemaVersionsIdGets a schema version.
projects_locations_schemas_schema_versions_listselectprojectsId, locationsId, schemasIdpageSize, pageTokenLists SchemaVersions.
projects_locations_schemas_schema_versions_createinsertprojectsId, locationsId, schemasIdCreates a schema version.
projects_locations_schemas_schema_versions_patchupdateprojectsId, locationsId, schemasId, schemaVersionsIdupdateMaskUpdates a schema version. Editable fields are: - display_name - labels
projects_locations_schemas_schema_versions_deletedeleteprojectsId, locationsId, schemasId, schemaVersionsIdDeletes a schema version.
projects_locations_schemas_schema_versions_generateexecprojectsId, locationsId, schemasIdGenerates a schema version.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
locationsIdstring
projectsIdstring
schemaVersionsIdstring
schemasIdstring
pageSizeinteger (int32)
pageTokenstring
updateMaskstring (google-fieldmask)

SELECT examples​

Gets a schema version.

SELECT
name,
createTime,
displayName,
labels,
schema
FROM google.documentai.schema_versions
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND schemasId = '{{ schemasId }}' -- required
AND schemaVersionsId = '{{ schemaVersionsId }}' -- required
;

INSERT examples​

Creates a schema version.

INSERT INTO google.documentai.schema_versions (
data__displayName,
data__labels,
data__name,
data__schema,
projectsId,
locationsId,
schemasId
)
SELECT
'{{ displayName }}',
'{{ labels }}',
'{{ name }}',
'{{ schema }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ schemasId }}'
RETURNING
name,
createTime,
displayName,
labels,
schema
;

UPDATE examples​

Updates a schema version. Editable fields are: - display_name - labels

UPDATE google.documentai.schema_versions
SET
data__displayName = '{{ displayName }}',
data__labels = '{{ labels }}',
data__name = '{{ name }}',
data__schema = '{{ schema }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND schemasId = '{{ schemasId }}' --required
AND schemaVersionsId = '{{ schemaVersionsId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
createTime,
displayName,
labels,
schema;

DELETE examples​

Deletes a schema version.

DELETE FROM google.documentai.schema_versions
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND schemasId = '{{ schemasId }}' --required
AND schemaVersionsId = '{{ schemaVersionsId }}' --required
;

Lifecycle Methods​

Generates a schema version.

EXEC google.documentai.schema_versions.projects_locations_schemas_schema_versions_generate
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@schemasId='{{ schemasId }}' --required
@@json=
'{
"baseSchemaVersion": "{{ baseSchemaVersion }}",
"gcsDocuments": "{{ gcsDocuments }}",
"gcsPrefix": "{{ gcsPrefix }}",
"generateSchemaVersionParams": "{{ generateSchemaVersionParams }}",
"inlineDocuments": "{{ inlineDocuments }}",
"rawDocuments": "{{ rawDocuments }}"
}'
;