Hello all,

I think Alexander is reading a binary AVRO file -- just that there is a 
serialised JSON string in one of the fields. I actually have read this exact 
kind of data from Azure Event Hub using the Python libraries before, so it 
should work.

Your code looks fine to me Alexander -- maybe you'd like to try reading a test 
file from another source just to make sure that there's nothing obvious like 
your file maybe being empty. I know that Event Hub writes empty files in its 
default configuration.

Lastly, I'll just note that in the end I used the "fastavro" library for my 
code rather than this reference (if that's the right word) Python 
implementation. It uses a C implementation and I found it to be 4 times faster, 
so I would recommend moving to that library at an early stage if speed is 
important.

From: Michael A. Smith <[email protected]>
Sent: Tuesday, 29 September 2020 7:42 AM
To: [email protected]
Subject: Re: How to use avro-python3 on Windows 10 to parse files?



________________________________
On Mon, Sep 28, 2020 at 14:24 Alexander Farber 
<[email protected]<mailto:[email protected]>> wrote:
Hi Michael -

On Mon, Sep 28, 2020 at 8:19 PM Michael A. Smith 
<[email protected]<mailto:[email protected]>> wrote:
Where did you find that avro-python3 is recommended? I would like to update 
that.

here: 
https://stackoverflow.com/a/43606979/165071<https://stackoverflow.com/a/43606979/165071>

avro-python3 is deprecated. Your should use the avro library instead.

If the avro library for python doesn't work, please let me know.

Yes, it does not work for me with python 3.8.0 - please see below

On Mon, Sep 28, 2020 at 12:43 Alexander Farber 
<[email protected]<mailto:[email protected]>> wrote:
With python 3.8.5 and avro 1.10.0 installed via pip I have tried running the 
following script:

import os, avro
from avro.datafile import DataFileReader, DataFileWriter
from avro.io<http://avro.io> import DatumReader, DatumWriter

reader = DataFileReader(open("48.avro", "rb"), DatumReader())
for d in reader:
    print(d)
reader.close()

Unfortunately, nothing is printed by the script.
https://stackoverflow.com/questions/64105500/how-to-use-avro-python3-on-windows-10-to-parse-files<https://stackoverflow.com/questions/64105500/how-to-use-avro-python3-on-windows-10-to-parse-files>

Michael, how could I debug this issue? I am an avro and python newbie

Greetings from Germany
Alex

Aha, sorry for reading carelessly! I think you are using a json-encoded avro 
file, yes? Python avro only supports binary encoded avro at this time. Does 
that help?

I will admit that I've never tried to use avro on windows. But I don't think 
that is the problem here.

Bupa A&NZ email disclaimer: The information contained in this email and any 
attachments is confidential and may be subject to copyright or other 
intellectual property protection. If you are not the intended recipient, you 
are not authorized to use or disclose this information, and we request that you 
notify us by reply mail or telephone and delete the original message from your 
mail system.

Reply via email to