Schemas

This page describes the commands to manage schemas in Lenses via the CLI.

View all schemas

View the current schemas registered:

lenses-cli schemas --unwrap [--output json/table/yaml [--query] [--no-pretty]]

The --unwrap flag is optional, prints only the names separated by new line

View a schema

Schemas can be filtered by name:

lenses-cli schema --name="sea_vessel_position_reports-value"

View schema versions

Schemas versions can be viewed filtered by name:

lenses-cli schema versions --name="sea_vessel_position_reports-value"
# view by version
lenses-cli schema --name="sea_vessel_position_reports-value" --version="latest"

View schema compatibility levels

Schema compatibility levels can be viewed and filtered by name:

lenses-cli schema compatibility --name="register1

Delete schemas

Delete all versions of a schema by name:

lenses-cli schema delete --name="coyote_test_02"

Delete schemas by version

Delete a specific version of a schema:

# (defaults to "latest" if not passed)
lenses-cli schema delete-version --name="register1" --version=2

Change the compatibility of a Schema

Change the compatibility level of a schema:

lenses-cli schema compatibility  set FULL --name="register1"

Register a schema

Register a new schema for a name/subject by the command line or file:

lenses-cli schema register \
  --name="schemaName" \
  --avro="{ \"type\": \"string\" }"

Register by file:

lenses-cli schema register ./schema.yaml

schema.yaml:

name: schemaName
avroSchema: |-
  {
    "type": "record",
    "name": "evolution",
    "namespace": "io.lenses",
    "doc": "This is a sample AVRO schema to get you started. Please edit",
    "fields": [
      {
       "name": "name",
       "type": "string"
      },
      {
       "name": "number1",
       "type": "int"
      },
      {
       "name": "number2",
       "type": "float"
      }
    ]
   }  

Last updated

Logo

2024 © Lenses.io Ltd. Apache, Apache Kafka, Kafka and associated open source project names are trademarks of the Apache Software Foundation.