Fast read/write of AVRO files
Actively maintained. Last release 8 weeks ago, commits in 14 of the last 26 weeks. A safe choice.
pip install fastavrofastavro
[!IMPORTANT] Fastavro is currently in maintenance mode. Efforts will be made to try to update to the latest versions of Python, fix security issues, and merge simple bug fixes or features, but even those might be significantly delayed.
Because the Apache Python avro package is written in pure Python, it is
relatively slow. In one test case, it takes about 14 seconds to iterate through
a file of 10,000 records. By comparison, the JAVA avro SDK reads the same file in
1.9 seconds.
The fastavro library was written to offer performance comparable to the Java
library. With regular CPython, fastavro uses C extensions which allow it to
iterate the same 10,000 record file in 1.7 seconds. With PyPy, this drops to 1.5
seconds (to be fair, the JAVA benchmark is doing some extra JSON
encoding/decoding).
fastavro supports the following Python versions:
- Python 3.10
- Python 3.11
- Python 3.12
- Python 3.13
- Python 3.14
- Python 3.15
- PyPy3
Supported Features
- File Writer
- File Reader (iterating via records or blocks)
- Schemaless Writer
- Schemaless Reader
- JSON Writer
- JSON Reader
- Codecs (Snappy, Deflate, Zstandard, Bzip2, LZ4, XZ)
- Schema resolution
- Aliases
- Logical Types
- Parsing schemas into the canonical form
- Schema fingerprinting
Missing Features
- Anything involving Avro's RPC features
Documentation
Documentation is available at http://fastavro.readthedocs.io/en/latest/
Installing
fastavro is available both on