# Test writing avros
from avro import schema, datafile, io
import pprint

OUTFILE_NAME = 'tmp/messages.avro'
# Test reading avros
rec_reader = io.DatumReader()

# Create a 'data file' (avro file) reader
df_reader = datafile.DataFileReader(
  open(OUTFILE_NAME),
  rec_reader
)

# Read all records stored inside
pp = pprint.PrettyPrinter()
for record in df_reader:
    pp.pprint(record)

970ca5cf2bfaa5f19c1a8527aaa6e38051ef7f40
<mask token>

<mask token>
for record in df_reader:
    pp.pprint(record)

<mask token>
OUTFILE_NAME = 'tmp/messages.avro'
rec_reader = io.DatumReader()
df_reader = datafile.DataFileReader(open(OUTFILE_NAME), rec_reader)
pp = pprint.PrettyPrinter()
for record in df_reader:
    pp.pprint(record)

from avro import schema, datafile, io
import pprint
OUTFILE_NAME = 'tmp/messages.avro'
rec_reader = io.DatumReader()
df_reader = datafile.DataFileReader(open(OUTFILE_NAME), rec_reader)
pp = pprint.PrettyPrinter()
for record in df_reader:
    pp.pprint(record)

# Test writing avros
from avro import schema, datafile, io
import pprint

OUTFILE_NAME = 'tmp/messages.avro'
# Test reading avros
rec_reader = io.DatumReader()

# Create a 'data file' (avro file) reader
df_reader = datafile.DataFileReader(
  open(OUTFILE_NAME),
  rec_reader
)

# Read all records stored inside
pp = pprint.PrettyPrinter()
for record in df_reader:
    pp.pprint(record)
