Skip to content

get_compatibility does not work for me #443

Closed
@charlie-white

Description

@charlie-white

Description

When I call the method get_compatibility of the CachedSchemaRegistryClient class I get an exception.

Traceback (most recent call last):
  File "utils/show_compatibilty.py", line 42, in <module>
    compatibility = schema_registry.get_compatibility()
  File "/Users/brgl/code/schema/env/lib/python2.7/site-packages/confluent_kafka/avro/cached_schema_registry_client.py", line 335, in get_compatibility
    raise ClientError('Invalid compatibility level received: %s' % error_msg_suffix)
confluent_kafka.avro.error.ClientError: Invalid compatibility level received: No compatibility was returned

I looked at the code, and on line 326 of cached_schema_registry_client.py I see the following line.
compatibility = result.get('compatibility', None)`

If I change the line to the following it works for me.
compatibility = result.get('compatibilityLevel', None)

While I am at it, in the same file on line 306:
raise ClientError("Unable to update level: %s. Error code: %d" % (str(level)), code)
should read:
raise ClientError("Unable to update level: %s. Error code: %d" % (str(level), code))
Paren in the wrong spot.

How to reproduce

schema_registry = CachedSchemaRegistryClient(SCHEMA_REGISTRY_URL)
compatibility = schema_registry.get_compatibility()

Checklist

Please provide the following information:

  • confluent-kafka-python and librdkafka version:
    confluent_kafka.version()
    ('0.11.5', 722176)
    confluent_kafka.libversion()
    ('0.11.5', 722431)

  • Apache Kafka broker version:
    $ confluent version
    Confluent Open Source: 4.1.1
    $ confluent version kafka
    1.1.1-cp1

  • Operating system: macOS - Sierra 10.12.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions