Skip to content

Commit 34b2aca

Browse files
author
Peter Cornelius
committed
Include the schemas with the example code so that the examples can be
easily run by cutting and pasting.
1 parent 94a0c36 commit 34b2aca

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

README.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,37 @@ c.close()
7171
from confluent_kafka import avro
7272
from confluent_kafka.avro import AvroProducer
7373

74-
value_schema = avro.load('ValueSchema.avsc')
75-
key_schema = avro.load('KeySchema.avsc')
74+
75+
value_schema_str = """
76+
{
77+
"namespace": "my.test",
78+
"name": "value",
79+
"type": "record",
80+
"fields" : [
81+
{
82+
"name" : "name",
83+
"type" : "string"
84+
}
85+
]
86+
}
87+
"""
88+
89+
key_schema_str = """
90+
{
91+
"namespace": "my.test",
92+
"name": "key",
93+
"type": "record",
94+
"fields" : [
95+
{
96+
"name" : "name",
97+
"type" : "string"
98+
}
99+
]
100+
}
101+
"""
102+
103+
value_schema = avro.loads(value_schema_str)
104+
key_schema = avro.loads(key_schema_str)
76105
value = {"name": "Value"}
77106
key = {"name": "Key"}
78107

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy