GithubHelp home page GithubHelp logo

confluent_schema_registry_client's Introduction

confluent_schema_registry_client

A simple Python client for Confluent's Schema Registry

Example

from confluent_schema_registry_client import SchemaRegistryClient
from confluent_schema_registry_client import CompatibilityLevel

c = SchemaRegistryClient('schema-registry.mydomain.com')

# Get the list of known subjects
c.get_subjects()
# => ['subject1', subject2]


# Register a new schema under a subject
schema = {
    "type": "record",
    "name": "test",
    "fields":
        [
            {
                "type": "string",
                "name": "field1"
            },
            {
                "type": "integer",
                "name": "field2"
            }
        ]
    }

schema_id = c.register_subject_version('subject1', schema)
# => 13


# Retrieve schema by id
c.get_schema(schema_id)
# => {"type": "record", "name": "test", "fields": [{"type": "string", name": "field1"}, {"type": "integer", "name": "field2"}]}


# Get the list of schema versions registered under a subject
c.get_subject_version_ids('subject1')
# => [1, 2, 3, 4]


# Retrieve a specific schema by subject and version id
c.get_subject_version('subject1', 4)
# => {"type": "record", "name": "test", "fields": [{"type": "string", name": "field1"}, {"type": "integer", "name": "field2"}]}


# Retrieve the latest registered version of a schema
c.get_subject_latest_version('subject1')
# => {"type": "record", "name": "test", "fields": [{"type": "string", name": "field1"}, {"type": "integer", "name": "field2"}]}


# Check if a schema is registered under a given subject
c.schema_is_registered_for_subject('subject1', schema)
# => True


# Check compatibility of schema with registered schema version
# Retrieve a specific schema by subject and version id
c.schema_is_compatible_with_subject_version('subject1', 4, schema)
# => True


# Get and set compatilibility levels
c.set_global_compatibility_level(CompatibilityLevel.full)
c.get_global_compatibility_level()
# => "FULL"
c.set_subject_compatibility_level('subject1', CompatibilityLevel.backward)
c.get_subject_compatibility_level('subject1')
# => "BACKWARD"

confluent_schema_registry_client's People

Contributors

tleach avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

chanakyamandava

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.