{"id":27248847,"url":"https://github.com/bakdata/faust-avro-serializer","last_synced_at":"2025-04-10T23:48:17.179Z","repository":{"id":48883200,"uuid":"274377852","full_name":"bakdata/faust-avro-serializer","owner":"bakdata","description":"An improved version of https://github.com/marcosschroh/python-schema-registry-client/","archived":false,"fork":false,"pushed_at":"2024-02-15T18:50:59.000Z","size":21,"stargazers_count":7,"open_issues_count":1,"forks_count":4,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-10T23:48:13.225Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bakdata.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-23T10:33:54.000Z","updated_at":"2023-09-12T11:17:56.000Z","dependencies_parsed_at":"2022-09-16T03:50:46.054Z","dependency_job_id":null,"html_url":"https://github.com/bakdata/faust-avro-serializer","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakdata%2Ffaust-avro-serializer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakdata%2Ffaust-avro-serializer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakdata%2Ffaust-avro-serializer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakdata%2Ffaust-avro-serializer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bakdata","download_url":"https://codeload.github.com/bakdata/faust-avro-serializer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248317727,"owners_count":21083528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-10T23:48:16.641Z","updated_at":"2025-04-10T23:48:17.172Z","avatar_url":"https://github.com/bakdata.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# faust-avro-serializer\n\nThis repo contains an improved version of the avro serializer from\nhttps://github.com/marcosschroh/python-schema-registry-client/. It expects the schema\nto be stored in the record itself in order to mimic the behavior of Confluent's Avro SerDe.\nIt uses Faust's [metadata](https://faust.readthedocs.io/en/latest/userguide/models.html#polymorphic-fields) capability inside the ``Record`` class to read the Avro schema \ndynamically.\n### Example\n\n```python\nfrom faust import Record, Schema, Stream\nfrom faust_avro_serializer import FaustAvroSerializer\nfrom schema_registry.client import SchemaRegistryClient\nimport faust\n\napp = faust.App('myapp', broker='kafka://localhost')\nmy_topic_name = \"my-dummy-topic\"\n\nclass MyRecordExample(Record):\n    _schema = {\n     \"type\": \"record\",\n     \"namespace\": \"com.example\",\n     \"name\": \"MyRecordExample\",\n     \"fields\": [\n       { \"name\": \"foo\", \"type\": \"string\" },\n       { \"name\": \"bar\", \"type\": \"string\" }\n     ]\n} \n    foo: str\n    bar: str\n\nclient = SchemaRegistryClient(\"http://my-schema-registry:8081\")\nserializer = FaustAvroSerializer(client, my_topic_name, False)\n\nschema_with_avro = Schema(key_serializer=str, value_serializer=serializer)\n\ndummy_topic = app.topic(my_topic_name, schema=schema_with_avro)\n\n@app.agents(dummy_topic)\nasync def my_agent(myrecord: Stream[MyRecordExample]):\n    async for record in myrecord:\n        print(record.to_representation())\n\n``` \n\nWhen the serializer calls the ``_dumps`` method, it searches for the ``__faust`` field inside the\nrecord. \nIf the serializer finds the field, it is resolving the class and reads the ``_schema`` field \ncontaining the Avro schema.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbakdata%2Ffaust-avro-serializer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbakdata%2Ffaust-avro-serializer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbakdata%2Ffaust-avro-serializer/lists"}