Importing schemas using Schema Registry API
One of the methods of importing schemas that were exported from one Schema Registry
instance into another Schema Registry instance is using the Schema Registry API. You can
also import schemas using curl
through the command line.
The following steps describe how to import schemas by using the Schema Registry Swagger UI.
- Ensure that the cluster, its hosts, and all its services are healthy.
- Ensure that Schema Registry is commissioned and running.
- Ensure that you have access to all credentials that are required to access and use Schema Registry.
- Ensure that you have access to a JSON file that contains the exported schemas that you want to import. For more information on how to export schemas, see Exporting schemas using Schema Registry API.
- Ensure that you are logged in as a user with access to the CDP environment containing the cluster with Schema Registry.
On successful import, a number of SchemaMetadata, SchemaBranch, and SchemaVersionInfo objects are added to the Schema Registry database.
Objects added to the database retain the following property values from the import
file:
- Schema Metadata objects retain the ID, type, schemaGroup, name, description, compatibility, validationLevel, and evolve properties.
- SchemaBranch objects retain the ID, name, schemaMetadataName, and description properties.
- SchemaVersionInfo objects retain the ID, schemaMetadataId, name, description, version, and schemaText properties.
A successful import also results in a JSON file that contains the
following:
{
"successCount": 0,
"failedCount": 0,
"failedIds": [
0
]
}
Where,
successCount
is the number of successfully imported SchemaVersionInfo objects.failedCount
is the number of SchemaVersionInfo objects that failed to import.failedIds
contains the IDs of failed SchemaVersionInfo objects.
Schemas (metadata/branch/version) that are already present in the
database are skipped during an import. Skipped schemas are not counted in
successCount
or failedCount
.