GetSchemaByDefinitionCommand

Retrieves a schema by the SchemaDefinition. The schema definition is sent to the Schema Registry, canonicalized, and hashed. If the hash is matched within the scope of the SchemaName or ARN (or the default registry, if none is supplied), that schema’s metadata is returned. Otherwise, a 404 or NotFound error is returned. Schema versions in Deleted statuses will not be included in the results.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { GlueClient, GetSchemaByDefinitionCommand } from "@aws-sdk/client-glue"; // ES Modules import
// const { GlueClient, GetSchemaByDefinitionCommand } = require("@aws-sdk/client-glue"); // CommonJS import
const client = new GlueClient(config);
const input = { // GetSchemaByDefinitionInput
  SchemaId: { // SchemaId
    SchemaArn: "STRING_VALUE",
    SchemaName: "STRING_VALUE",
    RegistryName: "STRING_VALUE",
  },
  SchemaDefinition: "STRING_VALUE", // required
};
const command = new GetSchemaByDefinitionCommand(input);
const response = await client.send(command);
// { // GetSchemaByDefinitionResponse
//   SchemaVersionId: "STRING_VALUE",
//   SchemaArn: "STRING_VALUE",
//   DataFormat: "AVRO" || "JSON" || "PROTOBUF",
//   Status: "AVAILABLE" || "PENDING" || "FAILURE" || "DELETING",
//   CreatedTime: "STRING_VALUE",
// };

GetSchemaByDefinitionCommand Input

Parameter
Type
Description
SchemaDefinition
Required
string | undefined

The definition of the schema for which schema details are required.

SchemaId
Required
SchemaId | undefined

This is a wrapper structure to contain schema identity fields. The structure contains:

  • SchemaId$SchemaArn: The Amazon Resource Name (ARN) of the schema. One of SchemaArn or SchemaName has to be provided.

  • SchemaId$SchemaName: The name of the schema. One of SchemaArn or SchemaName has to be provided.

GetSchemaByDefinitionCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
CreatedTime
string | undefined

The date and time the schema was created.

DataFormat
DataFormat | undefined

The data format of the schema definition. Currently AVRO, JSON and PROTOBUF are supported.

SchemaArn
string | undefined

The Amazon Resource Name (ARN) of the schema.

SchemaVersionId
string | undefined

The schema ID of the schema version.

Status
SchemaVersionStatus | undefined

The status of the schema version.

Throws

Name
Fault
Details
AccessDeniedException
client

Access to a resource was denied.

EntityNotFoundException
client

A specified entity does not exist

InternalServiceException
server

An internal service error occurred.

InvalidInputException
client

The input provided was not valid.

GlueServiceException
Base exception class for all service exceptions from Glue service.