CREATE SCHEMA_REGISTRY

Syntax

CREATE SCHEMA_REGISTRY schema_registry_name
WITH (schema_registry_parameter = value [, ... ]);

Description

Schema Registries are useful for storing and managing the many schemas that may define a user's data streams. These schemas are necessary for a system to marshal and unmarshal records and make sure the native data format matches the intended format. After creating a Schema Registry, look at how to UPDATE STORE to attach the Schema Registry to a Store. The Schema Registry that is created will be accessible to the user who created it and anyone who has been given permissions.

Schema Registries can only be created by a Role with CREATE_SCHEMA_REGISTRY privilege.

Schema Registry is required for working with Avro data

Currently supported Schema Registries are Confluent Cloud and Confluent Platform

Known Limitation: Confluent Schema Registry must use the default TopicNameStrategy for creating subject names

Arguments

schema_registry_name

Specifies the name of the new Schema Registry. For case-sensitive names, the name must be wrapped in double quotes, otherwise, the lowercased name will be used.

WITH (schema_registry_parameter = value [, …​ ])

This clause specifies Schema Registry parameters; see Schema Registry Parameters below for more information.

Schema Registry Parameters

Confluent Cloud Schema Registry Specific Parameters

Confluent Platform Schema Registry Specific Parameters

Examples

Create a Confluent Cloud Schema Registry

The following is an example statement that creates a new CONFLUENT_CLOUD Schema Registry named ConfluentCloudSR:

<no-db>/<no-store># CREATE SCHEMA_REGISTRY "ConfluentCloudSR" WITH (
    'type' = CONFLUENT_CLOUD,
    'access_region' = "AWS us-east-1",
    'uris' = 'https://abcd-efghi.us-east-2.aws.confluent.cloud',
    'confluent_cloud.key' = 'fake_key',
    'confluent_cloud.secret' = 'fake_secret'
);
+-----------------+------------------+------------+------------------------------------------+
|  Type           |  Name            |  Command   |  Summary                                 |
+=================+==================+============+==========================================+
| schema registry | ConfluentCloudSR | CREATE     | schema registry "ConfluentCloudSR" was   |
|                 |                  |            | successfully created                     |
+-----------------+------------------+------------+------------------------------------------+

Create a Confluent Platform Schema Registry

The following is an example statement that creates a new CONFLUENT Schema Registry named ConfluentPlatformSR:

<no-db>/<no-store># CREATE SCHEMA_REGISTRY "ConfluentPlatformSR" WITH (
    'type' = CONFLUENT,
    'access_region' = "AWS us-east-1",
    'uris' = 'https://url.to.schema.registry.listener:8081',
    'confluent.username' = 'fake_username',
    'confluent.password' = 'fake_password',
    'tls.client.cert_file' = '@/path/to/tls/client_cert_file',
    'tls.client.key_file' = '@/path/to/tls_key'
);
+-----------------+---------------------+------------+------------------------------------------+
|  Type           |  Name               |  Command   |  Summary                                 |
+=================+=====================+============+==========================================+
| schema registry | ConfluentPlatformSR | CREATE     | schema registry "ConfluentPlatformSR"    |
|                 |                     |            | was successfully created                 |
+-----------------+---------------------+------------+------------------------------------------+

Create a Schema Registry with credentials from a file

The following creates a new CONFLUENT_CLOUD Schema Registry named ConfluentCloudSR:

$ cat /User/user1/schema_registry/cc/properties.yaml
access_region: "AWS us-east-2"
uris: "https://abcd-efghi.us-east-2.aws.confluent.cloud"
confluent_cloud.key: "SR_KEY"
confluent_cloud.secret: "SR_SECRET"
CREATE SCHEMA_REGISTRY "ConfluentCloudSR" WITH (
    'type' = CONFLUENT_CLOUD,
    'properties.file' = '@/User/user1/schema_registry/cc/properties.yaml'
);

Last updated