You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/08/02 08:17:00 UTC

[GitHub] [pulsar] chariot1498 opened a new issue #4874: Not matching schema while using subrecords for Python client

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:
users@infra.apache.org


With regards,
Apache Git Services