Skip to content

Commit beccd37

Browse files
committed
Avro 1.11.0 moves SchemaParseException to avro.errors.
1 parent 1349af0 commit beccd37

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/confluent_kafka/avro/load.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def loads(schema_str):
2323
""" Parse a schema given a schema string """
2424
try:
2525
return schema.parse(schema_str)
26-
except schema.SchemaParseException as e:
26+
except SchemaParseException as e:
2727
raise ClientError("Schema parse failed: %s" % (str(e)))
2828

2929

@@ -42,6 +42,13 @@ def _hash_func(self):
4242
try:
4343
from avro import schema
4444

45+
try:
46+
# avro >= 1.11.0
47+
from avro.errors import SchemaParseException
48+
except ImportError:
49+
# avro < 1.11.0
50+
from avro.schema import SchemaParseException
51+
4552
schema.RecordSchema.__hash__ = _hash_func
4653
schema.PrimitiveSchema.__hash__ = _hash_func
4754
schema.UnionSchema.__hash__ = _hash_func

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy