schema_versions
Creates, updates, deletes, gets or lists a schema_versions resource.
Overview
| Name | schema_versions |
| Type | Resource |
| Id | aws.glue.schema_versions |
Fields
The following fields are returned by SELECT queries:
- list_schema_versions
- get_schema_version
| Name | Datatype | Description |
|---|---|---|
created_time | string | The date and time the schema version was created. |
schema_arn | string | The Amazon Resource Name (ARN) of the schema. (pattern: <code>arn:aws(-(cn|us-gov|iso(-[bef])?))?:glue:.*</code>) |
schema_version_id | string | The 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>) |
status | string | The status of the schema version. (AVAILABLE, PENDING, FAILURE, DELETING) |
version_number | integer (int64) | The version number of the schema. |
| Name | Datatype | Description |
|---|---|---|
created_time | string | The date and time the schema version was created. |
data_format | string | The data format of the schema definition. Currently AVRO, JSON and PROTOBUF are supported. (AVRO, JSON, PROTOBUF) |
schema_arn | string | The Amazon Resource Name (ARN) of the schema. (pattern: <code>arn:aws(-(cn|us-gov|iso(-[bef])?))?:glue:.*</code>) |
schema_definition | string | The schema definition for the schema ID. (pattern: <code>.\S.</code>) |
schema_version_id | string | The SchemaVersionId 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>) |
status | string | The status of the schema version. (AVAILABLE, PENDING, FAILURE, DELETING) |
version_number | integer (int64) | The version number of the schema. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list_schema_versions | select | region | 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. | |
get_schema_version | select | region | Get 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_version | insert | region, SchemaId, SchemaDefinition | 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. | |
remove_schema_version_metadata | update | region, MetadataKeyValue | Removes a key value pair from the schema version metadata for the specified schema version ID. | |
put_schema_version_metadata | replace | region, MetadataKeyValue | 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. | |
delete_schema_versions | delete | region | 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. |
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.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- list_schema_versions
- get_schema_version
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
;
Get 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.
SELECT
created_time,
data_format,
schema_arn,
schema_definition,
schema_version_id,
status,
version_number
FROM aws.glue.schema_versions
WHERE region = '{{ region }}' -- required
;
INSERT examples
- register_schema_version
- Manifest
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
;
# Description fields are for documentation purposes
- name: schema_versions
props:
- name: region
value: "{{ region }}"
description: Required parameter for the schema_versions resource.
- name: SchemaId
description: |
This is a wrapper structure to contain schema identity fields. The structure contains: SchemaId$SchemaArn: The Amazon Resource Name (ARN) of the schema. Either SchemaArn or SchemaName and RegistryName has to be provided. SchemaId$SchemaName: The name of the schema. Either SchemaArn or SchemaName and RegistryName has to be provided.
value:
SchemaArn: "{{ SchemaArn }}"
SchemaName: "{{ SchemaName }}"
RegistryName: "{{ RegistryName }}"
- name: SchemaDefinition
value: "{{ SchemaDefinition }}"
description: |
The schema definition using the DataFormat setting for the SchemaName.
UPDATE examples
- remove_schema_version_metadata
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
- put_schema_version_metadata
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
- delete_schema_versions
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
;