Skip to content

Commit

Permalink
Use str(Schema) rather than Schema.to_json to prevent fastavro fr…
Browse files Browse the repository at this point in the history
…om raising exception `TypeError: unhashable type: 'mappingproxy'`

Fixes confluentinc#1156
  • Loading branch information
ffissore committed Sep 30, 2021
1 parent a5663da commit 7335daf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/confluent_kafka/avro/serializer/message_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# derived from https://github.com/verisign/python-confluent-schemaregistry.git
#
import io
import json
import logging
import struct
import sys
Expand Down Expand Up @@ -79,7 +80,7 @@ def __init__(self, registry_client, reader_key_schema=None, reader_value_schema=
# Encoder support
def _get_encoder_func(self, writer_schema):
if HAS_FAST:
schema = writer_schema.to_json()
schema = json.loads(str(writer_schema))
parsed_schema = parse_schema(schema)
return lambda record, fp: schemaless_writer(fp, parsed_schema, record)
writer = avro.io.DatumWriter(writer_schema)
Expand Down

0 comments on commit 7335daf

Please sign in to comment.