Registry / data / confluent-avro

confluent-avro

JSON →
library1.8.0pypypiunverified

Avro serialization/deserialization (SerDe) library for use with Confluent Schema Registry and Apache Kafka. Version 1.8.0 supports Python 3.6+ and integrates with the confluent-kafka Python client. Release cadence is irregular.

pip install confluent-avro
INSTALL
IMPORT
SIG · CONFLUENT-AVRO
C
confluent-avro
datapythonv1.8.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AvroConsumer
from confluent_avro import AvroConsumer
from confluent_avro import AvroConsumer
AvroProducer
from confluent_avro import AvroProducer
SchemaRegistryClient
from confluent_avro.schema_registry import SchemaRegistryClient

Basic AvroProducer example with schema registry.

import os from confluent_avro import AvroProducer from confluent_kafka import avro def delivery_report(err, msg): if err is not None: print('Delivery failed:', err) else: print('Message delivered to', msg.topic()) conf = { 'bootstrap.servers': 'localhost:9092', 'schema.registry.url': 'http://localhost:8081' } # Define Avro schema value_schema = avro.loads('{"type": "record", "name": "User", "fields": [{"name": "name", "type": "string"}]}') producer = AvroProducer(conf, default_value_schema=value_schema) producer.produce(topic='users', value={'name': 'Alice'}, callback=delivery_report) producer.flush()
Debug
Known issues
breakingIn version 1.0 -> 1.5, the import path changed from `confluent_kafka.avro` to `confluent_avro`. Old code using `from confluent_kafka.avro import AvroConsumer` will break.
fix
Change imports to `from confluent_avro import AvroConsumer`.
affects: <1.0
deprecatedThe `confluent_avro.avro` module is deprecated; all public classes are now directly under `confluent_avro`.
fix
Use `from confluent_avro import AvroConsumer, AvroProducer`.
affects: >=1.5
gotchaThe library requires `fastavro` only for certain operations; it may be missing and cause obscure AttributeError.
fix
Install `fastavro` via pip if you experience serialization errors.
affects: all
Upgrade
Version history
1.8.0latest on PyPI · released May 21, 2020
Audit
Dependencies
confluent-kafkarequiredconsumer/producer integration
avro-python3requiredAvro schema handling
requestsrequiredHTTP calls to Schema Registry
fastavrooptionalfast Avro decoding (optional)
Agent activity
37 hits · last 30 days
node
36
OpenAI (training)
1
Resources
confluent-avro — pip install confluent-avro · libregistry