chariot1498 opened a new issue #4874: Not matching schema while using 
subrecords for Python client
URL: https://github.com/apache/pulsar/issues/4874
 
 
   In this piece of code when I print schema of Example it shows the type of 
sub without null but when I do producer send or encode it throws value error 
   
   ValueError: <__main__.test_complex.<locals>.MySubRecord object at 
0x1022fc790> (type <class '__main__.test_complex.<locals>.MySubRecord'>) do not 
match ['null', {'type': 'record', 'name': 'MySubRecord', 'fields': [{'name': 
'a', 'type': 'string'}]}]
   
   I thought doing required = True should have solved it but though in example 
schema it disappears but while doing producer send it still gives error 
   
   class MySubRecord(Record):
       a = String(required = True)
   
   class Example(Record):
       x = String(required=True)
       sub = MySubRecord(required=True)
   
   #Connect to pulsar
   client = pulsar.Client('pulsar://localhost:6650')
   producer = client.create_producer(
                       topic='tes',
                       schema=AvroSchema(Example) )

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to