Kafka Avro convenience methods
When using Avro messages in the context of Kafka as Data Integration solution, there are a couple of common problems. All of them are easy to solve and this library aims to help.
Common problems in the Kafka-Avro world
No detailed data type information
Problem: Avro supports base data types like String, Integer and the such plus a few logical data types like TimeMillis. But if data is moved from one database to another database via Kafka, what should the target database use as a data type?
Example: Source database has a NVARCHAR(10). In the Avro Schema that must be a String. If the table in the target is created based on the Avro Schema, the only proper data type for this column is NCLOB. With all the performance penalty involved with LOB datatypes.
Solution: Provide more Logical Data Types for Avro. Avro allows adding custom data types and they just annotate the schema. Zero impact to any existing code.
Schema and Field names are very restricted in Avro
Problem: A database has a column called "/BIC/MANDT000". This is not a valid Avro field name.
Solution: Name converters to turn names into Avro supported names and vice versa. The change should be as little as possible.
Add more metadata to the schema
Problem: Initially in the project only the data is put into the messages. Once the solution is in production users will ask questions like
- What are the primary keys of this record?
- Where did the record originate from? This topic contains records from multiple source systems.
- Why was the record sent by the source source system? Who triggered it, what is the location within the source (e.g. rowid)?
- Which transformations did the record undergo and what was the success of the transformation?
Solution: Add optional fields to the schema to provide space for this kind of information.
How is the record to be treated? Insert, delete,..?
Problem: In a Data Integration scenario data is not only appended but also deleted, updated, etc. How does the consumer know? The producer must provide that information.
Example: In the source database a delete of customer=1234 happened. The expectation is that this record flows through Kafka and a database consumer does delete the record from the target database.
Solution: Have a naming convention on how a produce provides this information in the record.
A Schema Builder better suited for dynamic creation
Problem: The Avro SchemaBuilder is well suited for fixed, well known schemas.
Example: A schema should be built based on a database table metadata, including primary key information, nullable etc.
Solution: An alternative SchemaBuilder better suited for such recursive calls.
Schemas must support an extension concept
Problem: Often multiple producers create data for the same schema. Hence the schema must be the superset of all. While that does make sense for most fields, some are more of technical nature and do not deserve an individual field just for itself.
Example: The source system has a gender column of type string, the Avro schema a gender as integer. The producer does convert each string to the official value but it would be nice if the original value is stored in the record as well somewhere for auditing purposes.
Solution: Each schema level has an __extension array to store key-value pairs.
Metadata
Release files for rtdi-kafkaavro 0.11.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rtdi_kafkaavro-0.11.7.tar.gz | 31.4 kB | Without provenance | Details for rtdi_kafkaavro-0.11.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rtdi_kafkaavro-0.11.7-py3-none-any.whl | Python 3 | none | any | Details for rtdi_kafkaavro-0.11.7-py3-none-any.whl |
Total release size: 62.6 kB
Release files / rtdi_kafkaavro-0.11.7.tar.gz
| Download URL | rtdi_kafkaavro-0.11.7.tar.gz |
|---|---|
| Size | 31.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d7ed0babe8a176b0f07b9070401581270fe9d0bdb469812316c7ff157121efb4
|
|
BLAKE2b-256 checksum How to use checksums |
10a4812940aa7c7d2f6362e8ca645b55c3c6076dcf242536f3613a0a4e938b5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.7
|
Release files / rtdi_kafkaavro-0.11.7-py3-none-any.whl
| Download URL | rtdi_kafkaavro-0.11.7-py3-none-any.whl |
|---|---|
| Size | 31.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
85d389477f1f83c91d0fcd8b358f6de0af6bf5449ff9aee6e870b58d471e3e6a
|
|
BLAKE2b-256 checksum How to use checksums |
9679436e0f6b62b76a7db6bfe3902cfb88cf07e7d67da7503a64b92b744edb79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.7
|
Security for rtdi-kafkaavro 0.11.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.