Skip to main content

schema_versions

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

Overview

Nameschema_versions
TypeResource
Idaws.glue.schema_versions

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
created_timestringThe date and time the schema version was created.
schema_arnstringThe Amazon Resource Name (ARN) of the schema. (pattern: <code>arn:aws(-(cn|us-gov|iso(-[bef])?))?:glue:.*</code>)
schema_version_idstringThe unique identifier of the schema version. (pattern: <code>[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}</code>)
statusstringThe status of the schema version. (AVAILABLE, PENDING, FAILURE, DELETING)
version_numberinteger (int64)The version number of the schema.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_schema_versionsselectregionReturns a list of schema versions that you have created, with minimal information. Schema versions in Deleted status will not be included in the results. Empty results will be returned if there are no schema versions available.
get_schema_versionselectregionGet the specified schema by its unique ID assigned when a version of the schema is created or registered. Schema versions in Deleted status will not be included in the results.
register_schema_versioninsertregion, SchemaId, SchemaDefinitionAdds a new version to the existing schema. Returns an error if new version of schema does not meet the compatibility requirements of the schema set. This API will not create a new schema set and will return a 404 error if the schema set is not already present in the Schema Registry. If this is the first schema definition to be registered in the Schema Registry, this API will store the schema version and return immediately. Otherwise, this call has the potential to run longer than other operations due to compatibility modes. You can call the GetSchemaVersion API with the SchemaVersionId to check compatibility modes. If the same schema definition is already stored in Schema Registry as a version, the schema ID of the existing schema is returned to the caller.
remove_schema_version_metadataupdateregion, MetadataKeyValueRemoves a key value pair from the schema version metadata for the specified schema version ID.
put_schema_version_metadatareplaceregion, MetadataKeyValuePuts the metadata key value pair for a specified schema version ID. A maximum of 10 key value pairs will be allowed per schema version. They can be added over one or more calls.
delete_schema_versionsdeleteregionRemove versions from the specified schema. A version number or range may be supplied. If the compatibility mode forbids deleting of a version that is necessary, such as BACKWARDS_FULL, an error is returned. Calling the GetSchemaVersions API after this call will list the status of the deleted versions. When the range of version numbers contain check pointed version, the API will return a 409 conflict and will not proceed with the deletion. You have to remove the checkpoint first using the DeleteSchemaCheckpoint API before using this API. You cannot use the DeleteSchemaVersions API to delete the first schema version in the schema set. The first schema version can only be deleted by the DeleteSchema API. This operation will also delete the attached SchemaVersionMetadata under the schema versions. Hard deletes will be enforced on the database. If the compatibility mode forbids deleting of a version that is necessary, such as BACKWARDS_FULL, an error is returned.

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
regionstringAWS region (default: us-east-1)

SELECT examples

Returns a list of schema versions that you have created, with minimal information. Schema versions in Deleted status will not be included in the results. Empty results will be returned if there are no schema versions available.

SELECT
created_time,
schema_arn,
schema_version_id,
status,
version_number
FROM aws.glue.schema_versions
WHERE region = '{{ region }}' -- required
;

INSERT examples

Adds a new version to the existing schema. Returns an error if new version of schema does not meet the compatibility requirements of the schema set. This API will not create a new schema set and will return a 404 error if the schema set is not already present in the Schema Registry. If this is the first schema definition to be registered in the Schema Registry, this API will store the schema version and return immediately. Otherwise, this call has the potential to run longer than other operations due to compatibility modes. You can call the GetSchemaVersion API with the SchemaVersionId to check compatibility modes. If the same schema definition is already stored in Schema Registry as a version, the schema ID of the existing schema is returned to the caller.

INSERT INTO aws.glue.schema_versions (
SchemaId,
SchemaDefinition,
region
)
SELECT
'{{ SchemaId }}' /* required */,
'{{ SchemaDefinition }}' /* required */,
'{{ region }}'
RETURNING
schema_version_id,
status,
version_number
;

UPDATE examples

Removes a key value pair from the schema version metadata for the specified schema version ID.

UPDATE aws.glue.schema_versions
SET
SchemaId = '{{ SchemaId }}',
SchemaVersionNumber = '{{ SchemaVersionNumber }}',
SchemaVersionId = '{{ SchemaVersionId }}',
MetadataKeyValue = '{{ MetadataKeyValue }}'
WHERE
region = '{{ region }}' --required
AND MetadataKeyValue = '{{ MetadataKeyValue }}' --required
RETURNING
latest_version,
metadata_key,
metadata_value,
registry_name,
schema_arn,
schema_name,
schema_version_id,
version_number;

REPLACE examples

Puts the metadata key value pair for a specified schema version ID. A maximum of 10 key value pairs will be allowed per schema version. They can be added over one or more calls.

REPLACE aws.glue.schema_versions
SET
SchemaId = '{{ SchemaId }}',
SchemaVersionNumber = '{{ SchemaVersionNumber }}',
SchemaVersionId = '{{ SchemaVersionId }}',
MetadataKeyValue = '{{ MetadataKeyValue }}'
WHERE
region = '{{ region }}' --required
AND MetadataKeyValue = '{{ MetadataKeyValue }}' --required
RETURNING
latest_version,
metadata_key,
metadata_value,
registry_name,
schema_arn,
schema_name,
schema_version_id,
version_number;

DELETE examples

Remove versions from the specified schema. A version number or range may be supplied. If the compatibility mode forbids deleting of a version that is necessary, such as BACKWARDS_FULL, an error is returned. Calling the GetSchemaVersions API after this call will list the status of the deleted versions. When the range of version numbers contain check pointed version, the API will return a 409 conflict and will not proceed with the deletion. You have to remove the checkpoint first using the DeleteSchemaCheckpoint API before using this API. You cannot use the DeleteSchemaVersions API to delete the first schema version in the schema set. The first schema version can only be deleted by the DeleteSchema API. This operation will also delete the attached SchemaVersionMetadata under the schema versions. Hard deletes will be enforced on the database. If the compatibility mode forbids deleting of a version that is necessary, such as BACKWARDS_FULL, an error is returned.

DELETE FROM aws.glue.schema_versions
WHERE region = '{{ region }}' --required
;