kafka-schema-registry
This library allows you to create topics on Kafka topics, associated with a Confluent Schema Registry, and publish messages on them.
It takes care of:
- creating the topic
- publishing the associated schema (or updating an existing one)
- serializing and publishing messages to Kafka
It works with kafka-python, and extra arguments are forwarded to it.
Installing
pip install kafka-schema-registry
Usage
from kafka_schema_registry import prepare_producer
SAMPLE_SCHEMA = {
"type": "record",
"name": "TestType",
"fields" : [
{"name": "age", "type": "int"},
{"name": "name", "type": ["null", "string"]}
]
}
producer = prepare_producer(
['localhost:9092'],
f'http://schemaregistry',
topic_name,
1,
1,
value_schema=SAMPLE_SCHEMA,
)
producer.send(topic_name, {'age': 34})
producer.send(topic_name, {'age': 9000, 'name': 'john'})
Running the tests
The test requires Docker in order to start a local Redpanda instance.
make start-redpandato start the servermake testto configure a virtualenv and run the tests
Metadata
Release files for kafka-schema-registry 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| kafka-schema-registry-0.1.2.tar.gz | 5.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kafka_schema_registry-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.2 kB
Release files / kafka-schema-registry-0.1.2.tar.gz
| Download URL | kafka-schema-registry-0.1.2.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9a68fe5aab6c69ceadc8399498ac2ff6582aec7fa53fb4af10f8722f0732882d
|
|
BLAKE2b-256 checksum How to use checksums |
2257096ebff00431d2b05ee1b9cff460c721a332564035abea223d60d91d9e9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.12.0 pkginfo/1.8.3 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.10.5
|
Release files / kafka_schema_registry-0.1.2-py3-none-any.whl
| Download URL | kafka_schema_registry-0.1.2-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7bc1d2ec8ccdd8575d348d486d912ac7778b8b674b2a0c73b0709a8186ca48c4
|
|
BLAKE2b-256 checksum How to use checksums |
9b4fcb78b2cd975fe14357af1a78627b8e32e4d65c37261ed765a471744af545
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.12.0 pkginfo/1.8.3 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.10.5
|