fastavro.schema

parse_schema(schema, _write_hint=True, _force=False)

Returns a parsed avro schema

It is not necessary to call parse_schema but doing so and saving the parsed schema for use later will make future operations faster as the schema will not need to be reparsed.

Parameters
  • schema (dict) – Input schema

  • _write_hint (bool) – Internal API argument specifying whether or not the __fastavro_parsed marker should be added to the schema

  • _force (bool) – Internal API argument. If True, the schema will always be parsed even if it has been parsed and has the __fastavro_parsed marker

Example:

from fastavro import parse_schema
from fastavro import writer

parsed_schema = parse_schema(original_schema)
with open('weather.avro', 'wb') as out:
    writer(out, parsed_schema, records)